• SQL2008报表三种实现Reporting Service2008匿名访问的方法(转)


    实现Reporting Service2008 的匿名访问是件比较费劲的事情,网上提供的方法挺多的,但总结起来起来能用的就三种:

      一种通过ReportViewer控件显示报表,在系统中添加一个专用用户,权限限制在浏览级别,然后在代码中实现身份接口,指定控件以该用户身份登录,这是变相的匿名访问;(详细见http://www.cnblogs.com/lonely7345/archive/2010/01/10/1643603.html)

      第二种是通过WebService来访问报表,是本人一篇博文(http://www.cnblogs.com/dege301/archive/2009/09/04/1560456.html)中介绍方法的衍生,细节不在说明,类似于第一种方法需要指定专门用户,也不是真正意义上的匿名访问;

      第三种就是MSDN上能找到的那种,更改4个配置文件并添加一个.dll文件,经本人测试,如果完全按照给的说明操作不可行,会出现“报表服务器配置错误”,但经过一些列改动之后该方法可行,并且是真正意义上的匿名访问,将在下文中给出详细步骤。

    涉及到的配置文件如下(目录视具体安装情况):

    1. C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer下的web.config、rsreportserver.config、rssrvpolicy.config

    2. C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager下的web.config

    注意:在配置之前先备份以上文件,以防失败!!!

    配置过程:

    1. 找到两个Web.config文件中的如下代码:

    <authentication mode="Windows" />

    <identity impersonate="true" />

    替换成:

    <authentication mode="None" />

    <identity impersonate="false"/>

    2. 找到rsreportserver.config文件中的如下代码:

    <Authentication>

    <AuthenticationTypes>

    <RSWindowsNegotiate/>

    <RSWindowsNTLM/>

    </AuthenticationTypes>

    <EnableAuthPersistence>true</EnableAuthPersistence>

    </Authentication>

    替换成:

    <Authentication>

    <AuthenticationTypes>

    <Custom/>

    </AuthenticationTypes>

    <EnableAuthPersistence>true</EnableAuthPersistence>

    </Authentication>

    3. 把文件Microsoft.Samples.ReportingServices.AnonymousSecurity.dll放到C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin目录下(注意:目录视具体安装情况而定)

    4. 找到rsreportserver.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>

    5. 找到文件rssrvpolicy.config中的如下代码:

    </NamedPermissionSets>

    <CodeGroup

    class="FirstMatchCodeGroup"

    version="1"

    PermissionSetName="Nothing">

    <IMembershipCondition

    class="AllMembershipCondition"

    version="1"

    />

    在后面添上如下代码(注意Url地址可能不同):

    <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 Files\Microsoft SQL Server\MSRS10.MSSQLSERVER2008\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll" />

    </CodeGroup>

    6. 重启Reporting Service服务。

  • 相关阅读:
    Spring service本类中方法调用另一个方法事务不生效问题(转载)
    JVM垃圾收集器
    LInkedHashMap实现最近被使用(LRU)缓存
    HTML模板与iframe框架
    Mybatis中常用sql语句
    从零到一: 后端接口文档
    Mysql日期处理
    Java-集合框架与数组的实际应用-组装Json字符串
    Mysql查询之 指定顺序排序
    Eclipse中复制项目后,怎么更改项目名等相关配置?
  • 原文地址:https://www.cnblogs.com/wallis0922/p/2134932.html
Copyright © 2020-2023  润新知