SSRS2005和SSRS2008之间还是有很多不同之处的,首先,前者需要配合IIS进行安装配置,而后者使用内置的IIS对外服务,且精简了很多的配置项,从入手难度上来讲,更加容易搭建报表服务;其次,我们通过应用程序获取报表列表的时候,也有一点儿需要注意的,前者的调用方式:
2 WebReference.ReportingService ReportingService = new GetReportsList.WebReference.ReportingService();
3 // Set the Credentials.
4 ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials;
5 // Set config values.
6 string ReportFootFolder = " /CHEPReports " ;
7
8 // Get a list of reports from the server.
9 WebReference.CatalogItem[] ReportItems = ReportingService.ListChildren(ReportFootFolder, true );
10
后者的调用方式:
2 ReportService2005.ReportingService2005 ReportingService = new GetReportsList.ReportService2005.ReportingService2005();
3 // Set the Credentials.
4 ReportingService.Credentials = System.Net.CredentialCache.DefaultCredentials;
5 // Set config values.
6 string ReportFootFolder = " /CHEPReports " ;
7 // Get a list of reports from the server.
8 ReportService2005.CatalogItem[] ReportItems = ReportingService.ListChildren(ReportFootFolder, true );
9
其实主要是在获取Web Reference的时候有很大的不同,其URL分别如下:
SSRS2005: http://localhost:8080/ReportServer/ReportService.asmx
SSRS2008: http://localhost:8080/reportserver/reportservice2005.asmx
注意:最后的*.asmx文件是不同的。
附1:遇到异常“Client found response content type of '', but expected 'text/xml'.The request failed with an empty response.”,则说明,在web.config中“applicationSettings->GetReportsList.Properties.Settings->setting->value”中的URL填写错误,修改正确后异常消失。
附2:遇到异常“Server did not recognize the value of HTTP Header SOAPAction:...”,则说明我们引用的报表服务和后台实例出现不匹配,即如果我们引用的是2008的报表服务,后台获取使用的如果还是2005的方式(见上),则会报这个异常。
希望能对你有所帮助~