Recently our project need to use report viewer control to display SSRS report in a web project. There is no any issues in development phase but when we try to deploy the web application to the IIS server, it gave use the following error.
There are two options to resolve this issue.
Solution 1: Install reportviewer distribution package on the web server.
If you installed your VS2010 on the local machine, then check the following local path:
\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\ReportViewer, there should be a file called ReportViewer.exe which can distributed 4 report viewer dlls to the Server’s GAC and register them as well, then your server pages can be displayed no problem.
Solution 2: Configure Web.config.
Sometimes, due to the security issue, your server may not allow to install those application distribution packages. You can config the web.config to achieve the same result.
Step 0: In the web project. Change the reference “Microsoft.ReportViewer.WebForms” property “CopyLocal” to “True”
Step 1: add the following declaration in the aspx page
<@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxx" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>"
Step 2: add the following two lines into the <assemblies> section
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxx" /> <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx" />
Step 3: add the following lines into the <httpHandler> section
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx" validate="false" />
However, when you added you will find a problem, because there are two httpHandlers actually, one is under tag, the other is under tag, so where you should added or both need to be filled in. The tricky is the system.web section is for configuring IIS 6.0, while the system.webserver version is used to configure IIS 7.0. IIS 7.0 includes a new ASP.NET pipeline and some configuration differences, hence the extra config sections. If you’re running IIS 7.0 in integrated mode only, you shouldn’t need to add the handlers to both sections. Adding it to system.web as well is a fallback for IIS 7.0 operating in classic mode.