<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
每次存取報表都需要windows驗證,這樣的報表給客戶確實很說不過去.
SSRS 可以匿名登入的設定步驟:
開發工具:SQL Server Business Intelligence Development Studio
資料庫: SQL2008
首先確定你的Reporting Services 目錄位置
預設為:C:Program FilesMicrosoft SQL ServerMSRS11.MSSQLSERVERReporting ServicesReportServer
開啟目錄會修改該目錄下的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 ServicesReportServerbin 下, (注意別把這個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 之下 --> <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Private_assembly" Description="This code group grants custom code full trust. "> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:Program FilesMicrosoft SQL ServerMSRS11.MSSQLSERVERReporting ServicesReportServerbinMicrosoft.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 FilesMicrosoft SQL ServerMSRS10.MSSQLSERVERReporting ServicesReportServer"; }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 + @"binMicrosoft.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 + @"binMicrosoft.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 + @"binMicrosoft.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內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45