在ReportingServices2005中我们需要匿名访问报表的时候,只需要在IIS里面做下简单设置就可以实现,而在ReportingServices2008(R2)中不在依靠IIS,只是占用的还是80端口而已。其实匿名访问有很多中解决办法,譬如:使用ReportViewer控件、与SharePoint集成等等......
下面我介绍SQL团队技术博客所提供的比较彻底而且通用的方法 。(注:修改配置文件前假如害怕出问题请提前备份)
第一步:编译SQL团队所提供的代码并将所生成的Microsoft.Samples.ReportingServices.AnonymousSecurity.dll文件拷贝到SQL Server的安装目录*:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting ServicesReportServerbin下
你的项目中还需引用Microsoft.ReportingServices.Interfaces.dll 否则编译会通不过
第二步:修改*:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting ServicesReportServer 和*:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting ServicesReportManager文件中的web.config文件,替换二者中的节点,将
<authentication mode="Windows" /> <identity impersonate="true"/>
替换为
<authentication mode="None" /> <identity impersonate="false"/>
第三步:修改*:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting ServicesReportServer修改rereportserver.config把
<Authentication> <AuthenticationTypes> <RSWindowsNegotiate/> <RSWindowsNTLM/> </AuthenticationTypes> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication>
修改为
<Authentication> <AuthenticationTypes> <Custom/> </AuthenticationTypes> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication>
第四步:修改*:Program FilesMicrosoft SQL ServerMSRS10_50.MSSQLSERVERReporting ServicesReportServer修改rereportserver.config在
<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>
到此为止,ReportingServices2008(R2)的匿名访问就大功告成了。
参考资料:
http://blogs.msdn.com/b/jameswu/archive/2008/07/15/anonymous-access-in-sql-rs-2008.aspx (官方教程)
http://lonely7345.cnblogs.com/ (对于AnonymousSecurity.dll有中文解释)
原文链接:http://www.cnblogs.com/zhukuanglong/archive/2011/06/07/2074374.html