Saturday, October 31, 2015

Why ReportViewer Control not working on IIS 7?





Symptoms:
  •  Unable to render ReportViewer in ASP.NET Web Pages while running on IIS7.
  •  You are able to view your reports on Report Manager as well as while you are debugging locally  but not able to view them on IIS7.
  •  You encounter JavaScript error when loading your report page with ReportViewer. Image buttons such as calendar appear as red ‘X’.
Cause:
  • When you add ReportViewer control is into web page(.aspx), the
    Reserved.ReportViewerWebControl.axd httpHandler is added to System.Web section of the Web.Config file. In IIS7, It should be added under System.WebServer section.
  • IIS7  Handler Mappings doesn’t contain Reserved.ReportViewerWebControl.axd httpHandler, and that’s why not able to render the some ReportViewer elements which is needed by the JavaScript.
Solution : 
1. Open Internet Information Services (IIS) Manger and select Default Web Site.
2. Under IIS Section, Double click on Handler Mappings.
1-Why ReportViewer Control not working on IIS 7
3. From Action Pane (Right Side of Handler Mappings Section), click on Add Managed Handler.
2-Why ReportViewer Control not working on IIS 7
4. Add Managed Handler dialog opens. In that, enter following values.
Request Path : Reserved.ReportViewerWebControl.axd
Type :Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Name : Reserved-ReportViewerWebControl-axd
3-Why ReportViewer Control not working on IIS 7
Then click on OK button.
Reserved-ReportViewerWebControl-axd handler is now added to your Handler Mappings list. Also notice that the following line has also been added to your application’s Web.config file under the system.webserver’s handler section:
<add name=”Reserved-ReportViewerWebControl-axd” path=”Reserved.ReportViewerWebControl.axd” verb=”*” type=”Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” resourceType=”Unspecified” preCondition=”integratedMode” />
Now try to run your report again.