Report Viewer control not showing report from SSRS

谁说我不能喝 提交于 2019-12-05 17:36:29
vikingben

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

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

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.

  1. Open IIS manager and select your application Under IIS section
  2. Double click on Handler Mappings icon On the Action pane on your
  3. Right click Add Managed Handler
  4. When the dialog opens enter the following:

    Request path: Reserved.ReportViewerWebControl.axd

    Type: Microsoft.Reporting.WebForms.HttpHandler

    Name: Reserved-ReportViewerWebControl-axd

  5. 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" %>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!