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

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

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

瀏覽:19日期: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
主站蜘蛛池模板: 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 在线钠离子分析仪-硅酸根离子浓度测定仪-油液水分测定仪价格-北京时代新维测控设备有限公司 | 废旧物资回收公司_广州废旧设备回收_报废设备物资回收-益美工厂设备回收公司 | 危废处理系统,水泥厂DCS集散控制系统,石灰窑设备自动化控制系统-淄博正展工控设备 | 杭州用友|用友软件|用友财务软件|用友ERP系统--杭州协友软件官网 | 安全光栅|射频导纳物位开关|音叉料位计|雷达液位计|两级跑偏开关|双向拉绳开关-山东卓信机械有限公司 | 丝杆升降机-不锈钢丝杆升降机-非标定制丝杆升降机厂家-山东鑫光减速机有限公司 | 北京乾茂兴业科技发展有限公司| 间甲酚,间甲酚厂家-山东祥东新材料 | 新中天检测有限公司青岛分公司-山东|菏泽|济南|潍坊|泰安防雷检测验收 | 窖井盖锯圆机_锯圆机金刚石锯片-无锡茂达金刚石有限公司 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 截齿|煤截齿|采煤机截齿|掘进机截齿|旋挖截齿-山东卓力截齿厂家报价 | 硫酸亚铁-聚合硫酸铁-除氟除磷剂-复合碳源-污水处理药剂厂家—长隆科技 | 加热制冷恒温循环器-加热制冷循环油浴-杭州庚雨仪器有限公司 | 闭端端子|弹簧螺式接线头|防水接线头|插线式接线头|端子台|电源线扣+护线套|印刷电路板型端子台|金笔电子代理商-上海拓胜电气有限公司 | 气密性检测仪_气密性检测设备_防水测试仪_密封测试仪-岳信仪器 | 液压油缸-液压站生产厂家-洛阳泰诺液压科技有限公司 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 【灵硕展览集团】展台展会设计_展览会展台搭建_展览展示设计一站式服务公司 | 档案密集柜_手动密集柜_智能密集柜_内蒙古档案密集柜-盛隆柜业内蒙古密集柜直销中心 | 派克防爆伺服电机品牌|国产防爆伺服电机|高低温伺服电机|杭州摩森机电科技有限公司 | 酵素生产厂家_酵素OEM_酵素加盟_酵素ODM_酵素原料厂家_厦门益力康 | 锯边机,自动锯边机,双面涂胶机-建业顺达机械有限公司 | 校服厂家,英伦校服定做工厂,园服生产定制厂商-东莞市艾咪天使校服 | 东莞猎头公司_深圳猎头公司_广州猎头公司-广东万诚猎头提供企业中高端人才招聘服务 | 水冷散热器_水冷电子散热器_大功率散热器_水冷板散热器厂家-河源市恒光辉散热器有限公司 | 进口便携式天平,外校_十万分之一分析天平,奥豪斯工业台秤,V2000防水秤-重庆珂偌德科技有限公司(www.crdkj.com) | 会议会展活动拍摄_年会庆典演出跟拍_摄影摄像直播-艾木传媒 | Maneurop/美优乐压缩机,活塞压缩机,型号规格,技术参数,尺寸图片,价格经销商 | 金联宇电缆总代理-金联宇集团-广东金联宇电缆实业有限公司 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | 长信科技产业园官网_西安厂房_陕西标准工业厂房 | 多米诺-多米诺世界纪录团队-多米诺世界-多米诺团队培训-多米诺公关活动-多米诺创意广告-多米诺大型表演-多米诺专业赛事 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 | 交通信号灯生产厂家_红绿灯厂家_电子警察监控杆_标志杆厂家-沃霖电子科技 | 蓝米云-专注于高性价比香港/美国VPS云服务器及海外公益型免费虚拟主机 | 智慧养老_居家养老_社区养老_杰佳通 | 小型手持气象站-空气负氧离子监测站-多要素微气象传感器-山东天合环境科技有限公司 | 高通量组织研磨仪-多样品组织研磨仪-全自动组织研磨仪-研磨者科技(广州)有限公司 | 智能门锁电机_智能门锁离合器_智能门锁电机厂家-温州劲力智能科技有限公司 |