电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術文章
文章詳情頁

SQL Server Reporting Services 匿名登錄的問題及解決方案

瀏覽:20日期:2023-03-06 14:25:37

每次訪問報表都需要windows驗證,這樣的報表給客戶確實很說不過去.

SSRS 可以匿名登錄的設定步驟:

環境:

  開發工具:SQL Server Business Intelligence Development Studio

  數據庫: SQL2008

首先確定你的Reporting Services 目錄位置

默認為:C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer

打開目錄會修改該目錄下的3個配置文件,分別為:rsreportserver.config ,rssrvpolicy.config ,web.config

解決步驟:

  1.打開rsreportserver.config

   修改Configuration/Authentication/AuthenticationTypes

   修改前:

<Authentication>    <AuthenticationTypes><RSWindowsNTLM/>    </AuthenticationTypes>    </Authentication>

修改后:

<Authentication>    <AuthenticationTypes><Custom/>    </AuthenticationTypes>    </Authentication>

2. 修改web.config

<!--節點:configuration/system.web/authentication --><!-- 修改前 --><authentication mode="Windows" /><identity impersonate="true" /><!-- 修改后 --><authentication mode="None" /><identity impersonate="false" />

3. 從微軟下載匿名登錄的范例項目
( 下載網址 http://blog.quasarinc.com/wp-content/uploads/2012/03/Microsoft.Samples.ReportingServices.AnonymousSecurity.zip),
并且重新編譯出一個新的 Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 動態庫,
范例為2010解決方案,其實里面用到的只是class1.cs文件,還有項目名稱不能變,和我們下面配置有直接關系.

打開解決方案 將 Microsoft.ReportingServices.Interfaces.dll 的引用移除,并添加本地服務器的這個文件,位置在 ..\Reporting Services\ReportServer\bin 下, (注意別把這個dll當成萬能的)

重新編譯會生成 :Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 將該文件放置bin目錄下

4.再次修改rsreportserver.config

<!--修改節點:Configuration/Extensions/Security/Extension --><!-- 修改前 --><Security>    <Extension Name="Windows" Type="Microsoft.ReportingServices.Authorization.WindowsAuthorization, Microsoft.ReportingServices.Authorization" /></Security><Authentication>    <Extension Name="Windows" Type="Microsoft.ReportingServices.Authentication.WindowsAuthentication, Microsoft.ReportingServices.Authorization" /></Authentication><!-- 修改后 --><Security>  <Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity" /></Security><Authentication>  <Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity" /></Authentication>

5. 在 rssrvpolicy.config 內新增一個節點

<!-- 要增加的節點 configuration/mscorlib/security/PolicyLevel 之下 --><CodeGroupversion="1"PermissionSetName="FullTrust"Name="Private_assembly"Description="This code group grants custom code full trust. ">  <IMembershipCondition   version="1"  Url="C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"  /></CodeGroup>

注意:這個Url,路徑是reporting services 目錄下新編譯的文件,不同數據庫版本,或安裝目錄不同,會有差異

6. 重新啟動 Reporting Services

完美解決,歷時半個月,這個問題終于告以段落,以后可以專心設計報表了.

以上解決方案參考于msdn上的一篇文章,做了些整理.

由于是程序員,所有手工做的事還是交給程序做,以上5個步驟,已使用程序實現:

起個名字叫:ssrs_onekey_nologin 全稱:sql server report serveics 一鍵匿名登錄配置.

主要功能,修改xml ,自己生成dll,copy至 bin目錄下.

使用說明:需錄入report services 目錄

代碼共享:

 class Program       {   static void Main(string[] args)   {       Console.WriteLine("請輸入Reporting Services目錄:為空則與c盤默認sql2008");       string a = Console.ReadLine();             string basePath;      if (string.IsNullOrEmpty(a))      { basePath = @"c:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer";      }else     { basePath = a;      }      Console.WriteLine("Reporting Services 目錄為:{0}", basePath);     Console.WriteLine("確認請按任意鍵...");     Console.ReadKey();      string bakPath = @"c:\SSRS_noLogin_bak\" + DateTime.Now.ToString("yyyyMMddHHmmss");    Directory.CreateDirectory(bakPath);    File.Copy(basePath + "\\rsreportserver.config", bakPath + "\\rsreportserver.config");    File.Copy(basePath + "\\web.config", bakPath + "\\web.config");     File.Copy(basePath + "\\rssrvpolicy.config", bakPath + "\\rssrvpolicy.config");       Console.WriteLine("第1步開始:");    Step1(basePath);    Console.WriteLine("第1步結束.");    Console.WriteLine("第2步開始:");    Step2(basePath);    Console.WriteLine("第2步結束.");     Console.WriteLine("第3步開始:");     Step3(basePath);    Console.WriteLine("第3步結束.");    Console.WriteLine("第4步開始:");     Step4(basePath);     Console.WriteLine("第4步結束.");     Console.WriteLine("第5步開始:");     Step5(basePath);     Console.WriteLine("第5步結束.");      Console.WriteLine("完成");   Console.ReadKey(); }  static void Step1(string basePath) {     string file = basePath + "\\rsreportserver.config";     XmlDocument doc = new XmlDocument();     doc.Load(file);  //Configuration     XmlNode xn = doc.SelectSingleNode("Configuration/Authentication/AuthenticationTypes");     XmlNode oldXn = xn.SelectSingleNode("RSWindowsNTLM");     if (oldXn == null)     { Console.WriteLine("未找到RSWindowsNTLM,或已更改");    }    else   {XmlNode newXn = doc.CreateElement("Custom");xn.ReplaceChild(newXn, oldXn);     }      doc.Save(file);   }static void Step2(string basePath) {     XmlDocument doc = new XmlDocument();     string file = basePath + "\\web.config";     doc.Load(file);    XmlNode xn2 = doc.SelectSingleNode("configuration/system.web/authentication");     XmlElement xm2 = (XmlElement)xn2;      xm2.SetAttribute("mode", "None");     XmlNode xn3 = doc.SelectSingleNode("configuration/system.web/identity");   XmlElement xm3 = (XmlElement)xn3;    xm3.SetAttribute("impersonate", "false");    doc.Save(file);}  static void Step3(string basePath)  {    CSharpCodeProvider objCSharpCodePrivoder = new CSharpCodeProvider();     CompilerParameters objCompilerParameters = new CompilerParameters();     objCompilerParameters.ReferencedAssemblies.Add("System.dll");     objCompilerParameters.ReferencedAssemblies.Add(basePath + @"\bin\Microsoft.ReportingServices.Interfaces.dll");     string strSourceCode = Resources.Class1;     objCompilerParameters.GenerateInMemory = false;    objCompilerParameters.OutputAssembly = "Microsoft.Samples.ReportingServices.AnonymousSecurity.dll";    CompilerResults cr = objCSharpCodePrivoder.CompileAssemblyFromSource(objCompilerParameters, strSourceCode);     if (cr.Errors.HasErrors)    { string strErrorMsg = cr.Errors.Count.ToString() + " Errors:"; for (int x = 0; x < cr.Errors.Count; x++) {    strErrorMsg = strErrorMsg + "/r/nLine: " + cr.Errors[x].Line.ToString() + " - " +  cr.Errors[x].ErrorText; } Console.WriteLine(strErrorMsg); return;    }     File.Copy("Microsoft.Samples.ReportingServices.AnonymousSecurity.dll", basePath + @"\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll", true);     File.Delete("Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"); } static void Step4(string basePath){     XmlDocument doc = new XmlDocument();     string file = basePath + "\\rsreportserver.config";    doc.Load(file);     XmlNode xn2 = doc.SelectSingleNode("Configuration/Extensions/Security/Extension");    XmlElement xm2 = (XmlElement)xn2;     xm2.SetAttribute("Name", "None");     xm2.SetAttribute("Type", "Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity");    XmlNode xn3 = doc.SelectSingleNode("Configuration/Extensions/Authentication/Extension");    XmlElement xm3 = (XmlElement)xn3;    xm3.SetAttribute("Name", "None");    xm3.SetAttribute("Type", "Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity");      doc.Save(file); }  static void Step5(string basePath){    XmlDocument doc = new XmlDocument();     string file = basePath + "\\rssrvpolicy.config";     doc.Load(file);    XmlNode xn1 = doc.SelectSingleNode("configuration/mscorlib/security/PolicyLevel/CodeGroup[@class=UnionCodeGroup]");    if (xn1 != null)    {//已添加    }   else     { XmlNode xn = doc.SelectSingleNode("configuration/mscorlib/security/policy/PolicyLevel"); XmlElement xe = doc.CreateElement("CodeGroup");xe.SetAttribute("class", "UnionCodeGroup"); xe.SetAttribute("version", "1"); xe.SetAttribute("PermissionSetName", "FullTrust"); xe.SetAttribute("Name", "Private_assembly");xe.SetAttribute("Description", "This code group grants custom code full trust.");  XmlElement xe2 = doc.CreateElement("IMembershipCondition"); xe2.SetAttribute("class", "UrlMembershipCondition"); xe2.SetAttribute("version", "1");xe2.SetAttribute("Url", basePath + @"\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"); xe.AppendChild(xe2);xn.AppendChild(xe);   }    doc.Save(file);}      } }ssrs onkey no login

程序共享:

解決后測試頁的展示:

到此這篇關于關于 SQL Server Reporting Services 匿名登錄的解決方案的文章就介紹到這了,更多相關SQL Server Reporting Services內容請搜索以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持!

標簽: MsSQL
主站蜘蛛池模板: PAS糖原染色-CBA流式多因子-明胶酶谱MMP-上海研谨生物科技有限公司 | 紫外线老化试验箱_uv紫外线老化试验箱价格|型号|厂家-正航仪器设备 | 聚合氯化铝-碱式氯化铝-聚合硫酸铁-聚氯化铝铁生产厂家多少钱一吨-聚丙烯酰胺价格_河南浩博净水材料有限公司 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 智慧农业|农业物联网|现代农业物联网-托普云农物联网官方网站 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 振动筛,震动筛,圆形振动筛,振动筛价格,振动筛厂家-新乡巨宝机电 蒸汽热收缩机_蒸汽发生器_塑封机_包膜机_封切收缩机_热收缩包装机_真空机_全自动打包机_捆扎机_封箱机-东莞市中堡智能科技有限公司 | 山东信蓝建设有限公司官网 | 捆扎机_气动捆扎机_钢带捆扎机-沈阳海鹞气动钢带捆扎机公司 | 广东燎了网络科技有限公司官网-网站建设-珠海网络推广-高端营销型外贸网站建设-珠海专业h5建站公司「了了网」 | 永嘉县奥阳陶瓷阀门有限公司| 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 环压强度试验机-拉链拉力试验机-上海倾技仪器仪表科技有限公司 | 热缩管切管机-超声波切带机-织带切带机-无纺布切布机-深圳市宸兴业科技有限公司 | 宝宝药浴-产后药浴-药浴加盟-艾裕-专注母婴调养泡浴 | OLChemim试剂-ABsciex耗材-广州市自力色谱科仪有限公司 | 湖州织里童装_女童男童中大童装_款式多尺码全_织里儿童网【官网】-嘉兴嘉乐网络科技有限公司 | 机器视觉检测系统-视觉检测系统-机器视觉系统-ccd检测系统-视觉控制器-视控一体机 -海克易邦 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 北京遮阳网-防尘盖土网-盖土草坪-迷彩网-防尘网生产厂家-京兴科技 | 伊卡洛斯软装首页-电动窗帘,别墅窗帘,定制窗帘,江浙沪1000+别墅窗帘案例 | 炭黑吸油计_测试仪,单颗粒子硬度仪_ASTM标准炭黑自销-上海贺纳斯仪器仪表有限公司(HITEC中国办事处) | 山东聚盛新型材料有限公司-纳米防腐隔热彩铝板和纳米防腐隔热板以及钛锡板、PVDF氟膜板供应商 | 沧州友城管业有限公司-内外涂塑钢管-大口径螺旋钢管-涂塑螺旋管-保温钢管生产厂家 | 浙江宝泉阀门有限公司| 熔体泵_熔体出料泵_高温熔体泵-郑州海科熔体泵有限公司 | 袋式过滤器,自清洗过滤器,保安过滤器,篮式过滤器,气体过滤器,全自动过滤器,反冲洗过滤器,管道过滤器,无锡驰业环保科技有限公司 | 福建省教师资格证-福建教师资格证考试网| 深圳展厅设计_企业展馆设计_展厅设计公司_数字展厅设计_深圳百艺堂 | 大通天成企业资质代办_承装修试电力设施许可证_增值电信业务经营许可证_无人机运营合格证_广播电视节目制作许可证 | 苏商学院官网 - 江苏地区唯一一家企业家自办的前瞻型、实操型商学院 | 不锈钢复合板|钛复合板|金属复合板|南钢集团安徽金元素复合材料有限公司-官网 | 铝镁锰板_铝镁锰合金板_铝镁锰板厂家_铝镁锰金属屋面板_安徽建科 | 昆山PCB加工_SMT贴片_PCB抄板_线路板焊接加工-昆山腾宸电子科技有限公司 | HV全空气系统_杭州暖通公司—杭州斯培尔冷暖设备有限公司 | 微水泥_硅藻泥_艺术涂料_艺术漆_艺术漆加盟-青岛泥之韵环保壁材 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 润滑油加盟_润滑油厂家_润滑油品牌-深圳市沃丹润滑科技有限公司 琉璃瓦-琉璃瓦厂家-安徽盛阳新型建材科技有限公司 | TPU薄膜_TPU薄膜生产厂家_TPU热熔胶膜厂家定制_鑫亘环保科技(深圳)有限公司 | 山东聚盛新型材料有限公司-纳米防腐隔热彩铝板和纳米防腐隔热板以及钛锡板、PVDF氟膜板供应商 | 液氮罐(生物液氮罐)百科-无锡爱思科 | 电磁铁_推拉电磁铁_机械手电磁吸盘电磁铁厂家-广州思德隆电子公司 |