问题
I'm using MS Report Viewer 10 in VS 2013; the project is being upgraded from VS 2010. I have worked through a series of issues relating to Report Viewer, and have the control itself up and running. I have a number of reports in SSRS, and I have confirmed that the reports themselves work properly.
I have a Web Forms ASPX page for data input. It passes data via JSON to a popup ASPX page that contains the Report Viewer control.
I am running IIS Express 7, SQL Server 2008 R2 (v10.50), and a current target framework of .NET Framework 4.5.
Report Viewer does not return any report -- no error message, no report layout missing data, and certainly no complete report. When I run the same report with the same inputs through VS, the report preview shows the results I expect.
ProcessingMode
is set to Remote
and ReportServerCredentials
is null
. I researched what this means, and it means that Report Viewer should connect to SSRS with the current network credentials, namely the current user. I confirmed that the current user correctly matches my current login; I can connect to SSRS and SQL Server using Windows authentication properly.
ReportViewer doesn't create in the web form designer, so I can't set any properties on it at design time.
So I suspect my issue is a matter of authentication at run time. I am out of ideas on how to investiagte and resolve this.
The control code on the page:
<ssrs:ReportViewer ID="ReportViewer" runat="server" ProcessingMode="Remote" Width="100%"
Height="690" ShowParameterPrompts="false" AsyncRendering="false"/>
The SSRS log contains the following entries after I attempt to run the report:
library!ReportServer_0-3!1dc8!(datetime): i INFO: RenderForNewSession('(report)')
webserver!ReportServer_0-3!1dc8!(datetime, 1 second later): i INFO: Processed report. Report='(report)', Stream=''
The legacy project used MS Report Viewer 9. It ran just fine. The only changes I see in web.config
relate to the later version and a change from IIS 6 to IIS 7.
Since it came up in comments, here's the relevant line from web.config:
<system.webServer>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
My Report Viewer window:
ETA 24 Nov: I eventually got an entry in the application log: HttpHandlerInputException, Missing URL parameter: IterationId
. This issue has been discussed at another STOF Q&A.
回答1:
As requested by @CodeswithHammer I'm adding this reference to another thread for just to save people some time searching for it.
https://stackoverflow.com/a/22000827/1807669
回答2:
Below is code snippet using which i am using to bind ReportViewer with SSRS report
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerNetworkCredentials("ReportServerUsername", "ReportServerPassword", "");
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://mymachinename//ReportServer");
ReportViewer1.ServerReport.ReportPath = "/MyReports/TestReport1";
Here ReportServerUrl is path of SQL Report Server(SSRS) configured in my machine and in ReportPath "MyReports" is folder in SQL Report Server in which i have Report named TestReport1
回答3:
When you update version of the SSRS control in your app and web.config you also need to add a new handler for it in IIS. If you had one in your mappings previously remove it and add a new one.
- Open IIS manager and select your application Under IIS section
- Double click on Handler Mappings icon On the Action pane on your
- Right click Add Managed Handler
When the dialog opens enter the following:
Request path: Reserved.ReportViewerWebControl.axd
Type: Microsoft.Reporting.WebForms.HttpHandler
Name: Reserved-ReportViewerWebControl-axd
Cick OK
Also makesure your server, credentials and path to your report are correct.
var serverReport = this.ReportViewer1.ServerReport;
serverReport.ReportServerCredentials = new ReportServerCredentials(userName, password, "yourDomain.com");
serverReport.ReportServerUrl = new Uri("your report server");
serverReport.ReportPath = "yourReportName";
serverReport.Refresh();
And in your aspx:
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
来源:https://stackoverflow.com/questions/33419047/report-viewer-control-not-showing-report-from-ssrs