Well, thatβs why I really understood how to accomplish this seemingly impossible task.
Before you begin, let me say that if you are working with SQL Server Reporting Services 2008 (SSRS 08) and have (i.e. you have no choice) to use something like Basic auth, you will only find the world hurts with WCF based on services and IIS. In the future, I will talk about the configuration.
The short answer is as follows:
- Connect (e.g. new ReportingService2005 () or ReportingService2005SoapClient ())
Note. It's easier to use the old (pre-WCF) ASMX service, but it's not impossible to use the new version of CF. Authentication requires some configuration. There are also some minor syntax changes between versions.
- Find the report history you are looking for, for example. ReportHistorySnapshot [] history = reportServer.ListReportHistory (@ "/ Reports / MyHandyReport");
- Get History ID from any snapshot you want (returned from ListHistoryReport)
Now use ReportViewer to render the historical report, like any other report, for example:
ReportViewer rv = new ReportViewer ();
rv.ProcessingMode = ProcessingMode.Remote;
rv.ServerReport.ReportServerUrl = new Uri (@ " http: // localhost / reportserver ");
rv.ServerReport.ReportPath = @ "/ Reports / MyHandyReport";
rv.ServerReport.HistoryId = historyId;
//...snip
byte [] bytes = rv.ServerReport.Render ("Excel", null, out mimeType, out encoding, out extension, out streamids, out warnings);
Note. You can also use the second WCF web service (ReportExecution2005.asmx? Wsdl) as well as to run reports
source share