標籤:
SQL SERVER 2008 R2 是微軟目前最新的資料庫版本,在之前的SQL SERVER 2005中,我們可以通過修改IIS對應的SSRS網站及SSRS的設定檔,將SSRS配置成匿名登入的方式,把報表整合到系統中,而現在SSRS2008 R2已經和IIS完全分離,所以說我們在沿用2005的配置方法是不可行的,為了讓大家能夠更好的瞭解,下面將先給大家簡單介紹一下我在開發過程中,遇到的整合SSRS報表的情境。不同的整合有不同的解決方案。
1、ASP.net中整合SSRS的報表,這種整合方式,我們一般採用的方法是使用Report viewer控制項展示報表,在這種情況下,如果,我們不做任何的處理,用戶端在訪問我們的報表時會提示window身分識別驗證的輸入框,我們只有輸入使用者名稱和密碼才能正常的訪問報表,在這種情境下,如果,我們想去掉windows的驗證框,我們可以實現SSRS的一個介面(IReportServerCredential),該介面提供報表的三種身分識別驗證方式(WindowsCredential、NetWorkCrendtial、FormCredential),而我們要使用的就是第二種身分識別驗證方式。我們需要實現介面中的方法,new NetWorkCredential(username,password,domain)然後將Report Viewer的Credential屬性設定成我們實現介面類的對象,這樣就間接的實現了我們的報表匿名登入。 當然,在第一種情境中,我們也可以使用SSRS的webservice,目前webservice的版本有2005、2010兩個版本,直接將webservice添加引用即可(http://hostname:port/reportserver/reportservice2005.asmx或reportservice2010.asmx),這裡就不詳細說了。 2、第二種方式是在sharepoint中整合SSRS報表,這種方式,我們一般採用部署的方式,就可以解決SSRS存取權限的問題,我們一般採用將SSRS安裝成,sharepoint整合模式的安裝方式,這樣SSRS就會繼承sharepoint的許可權管理,我們要做的就是做好sharepoint的許可權控管就可以了。 3、第三種方式,也是我們今天著重要推薦的方式,是通過修改設定檔,以及添加程式集的方式,實現SSRS真正意義上的匿名登入。下面我把步驟介紹給大家。 3(1)、首先我們找到SSRS安裝目錄下的兩個web.config設定檔,預設安裝目錄分別是(C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer和C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager),然後,找到兩個設定檔中的<authentication mode="windows" /> <identity impersonate="true" /> 將其改為<authentication mode="None"/> <identity impersonate="false" /> 3(2)、找到(C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer)目錄下的rsreportserver.config檔案,找到設定檔中的 <Authentication> <AuthenticationTypes> <RSWindowsNegotiate/> <RSWindowsNTLM/> </AuthenticationTypes> <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel> <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication> 將其改為<Authentication> <AuthenticationTypes> <Custom/> </AuthenticationTypes> <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel> <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario> <EnableAuthPersistence>true</EnableAuthPersistence> </Authentication> 然後找到設定檔中的 <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> 從上邊兩個節點中我們可以看出,我們需要引用一個dll檔案,就是Microsoft.Samples.ReportingServices.AnonymousSecurity.dll,我們需要將這個dll放入到(C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin)目錄下。 3(3)、在將dll放入到目錄以後,我們來繼續修改我們的設定檔,在(C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer)目錄下,找到rssrvpolicy.config找到<CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="Nothing"> <IMembershipCondition class="AllMembershipCondition" version="1" />在其下邊追加如下節點(紅色部分,按照你的實際路徑而定) <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Private_assembly" Description="This code grou p grants custom code full trust."> <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL
Server\MSRS10_50.MSSQLSERVER2008\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll" />
</CodeGroup>
到此為止,我們匿名登入的方式,配置工作就完成了,下面我將在配置完成後訪問報表時,出現的幾種錯誤的解決方案說明一下。 部落格原文:http://blog.sina.com.cn/s/blog_7778950d0100qa61.html dll 下載 ssrs_onekey_nologin.zip
Microsoft SQL SERVER 2008 R2 REPORT SERVICE 匿名登入