Report Viewer Toolbar does not render properly on IIS 7.0

I was recently working on a reporting web application that uses the Report Viewer ( ReportViewer ) control that ships with SQL Server Reporting Services (SSRS). The Report Viewer control was rendering perfectly when I was developing using Visual Studio 2008. The trouble started when I published the web application to an IIS 7.0 server. The Toolbar was completely broken and showed up something like this.

SSRStoolbar

 <rsweb:ReportViewer AsyncRendering="false" ID="reportViewer" Width="100%" Height="100%" runat="server" SizeToReportContent="True" > </rsweb:ReportViewer>

Initially it looked like just the images where missing. But the toolbar was completely broken. The toolbar of the Report Viewer control relies on images and JavaScript that are generated dynamically. It uses a call to the Reserved.ReportViewerWebControl.axd to dynamically generate the images and the JavaScript. Something like

GET /Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=9.0.30729.1&Name=Microsoft.Reporting.WebForms.Icons.NextPage.gif HTTP/1.1

GET /Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=9.0.30729.1&Name=Microsoft.Reporting.WebForms.Icons.LastPage.gif HTTP/1.1

When you use the Report Viewer Control Visual Studio edits your web.config to map a Http Handler to respond to these requests.

 <system.web>
  <httpHandlers>
  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
  </httpHandlers>
</system.web>

The above entry tells ASP.NET that whenever a call is made to ReportViewerWebControl.axd use the Microsoft.Reporting.WebForms.HttpHandler assembly to execute it.

This mapping is very important because if you remove it the web server will return a 404 “File Not Found” error code because the ReportViewerWebControl.axd does not exist physically on the server.

Strangely when I checked the IIS 7.0 logs for the broken scenario I found that all requests for ReportViewerWebControl.axd had failed with a 404.

With IIS 7.0 there was an architectural change. There were changes to the web.config structure as well. The <httpHandlers> section that was under the <system.web> has now moved to <handlers> under <system.webServer>

Visual Studio had edited the web.config based on the IIS 6.0 model and had made an entry for the Http Handler under the <httpHandler> section. With IIS 7.0 this section is no longer read. So we need to make the proper entries for the Http Handler that handles the calls to ReportViewerWebControl.axd

 <system.webServer>
    <handlers>
    <add name="ReportViewerWebControl" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </handlers>
</system.webServer>

IIS 7.0 will now understand that whenever a call is made to ReportViewerWebControl.axd it needs to route it to the Http Handler Microsoft.Reporting.WebForms.HttpHandler

Cross posted from Vijay’s Blog ( https://blogs.msdn.com/vijaysk/archive/2009/01/14/report-viewer-toolbar-does-not-render-properly-on-iis-7-0.aspx )

Comments

  • Anonymous
    February 10, 2009
    PingBack from http://www.clickandsolve.com/?p=5995

  • Anonymous
    February 12, 2009
    The comment has been removed

  • Anonymous
    April 02, 2009
    The comment has been removed

  • Anonymous
    May 21, 2009
    Vijay, The first time I deployed my .NET web app to IIS 7.0 on Vista Home Premium and requested my report I got the report bar but no report results.  I googled the error message and found your post.  BAM! you hit it right on the nose.  Placing the ReportViewerWebControl as an add name in the handlers tag list of the system.WebServer tag in web app WebConfig file worked.  Report displayed as usual with no errors.  Thanks!

  • Anonymous
    May 25, 2009
    Thanks! This post help me so much!!

  • Anonymous
    June 11, 2009
    Thank you sir!  You really helped me out. -Rich

  • Anonymous
    June 30, 2009
    Thanks, just what I needed! (Except I needed an 8.0.0.0 tag.) <add name="ReportViewerWebControl" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

  • Anonymous
    July 06, 2009
    Yes no doubt this is a very helpful and good post.

  • Anonymous
    July 21, 2009
    Hi, How can this help us while viewing the reports thru an application attached to SSL. We are not able to view reports when accessed from https.... Appreciate any help

  • Anonymous
    August 03, 2009
    Thank you, I helped me. I was struggling for a week to fix this.

  • Anonymous
    August 31, 2009
    THANKS A TON!  My app was working fine without the about until a redirect was involved.  I don't know what the redirect did to mess it up, but am sure glad this fixed it.  Kudos!

  • Anonymous
    September 01, 2009
    Thanks so much. This fixed my problem that was a headache for me for many weeks.

  • Anonymous
    September 01, 2009
    It worked for me at the time when I was getting out of my mind on how to fix this. Thanks a lot.

  • Anonymous
    December 03, 2009
    Thanks a Lot!! it helped me tooo

  • Anonymous
    December 05, 2009
    You are awesome!!! Saved me so much time, would have never none to do that.

  • Anonymous
    December 29, 2009
    Thanks! From argentina, thanks!

  • Anonymous
    January 12, 2010
    You the man, this had me beat for hours

  • Anonymous
    January 19, 2010
    My thanks for finding the solution for me also. Added the handler and now the images are shown.  Wish MS had automatically added that entry to web.config.

  • Anonymous
    January 25, 2010
    THANK YOU! I have been struggling for past few hours.

  • Anonymous
    March 11, 2010
    thanks a bunch .... informative post !!

  • Anonymous
    April 05, 2010
    Check the complete solution here. It helps. http://praveenbattula.blogspot.com/2010/03/fix-to-report-viewer-problems-in-iis-7.html

  • Anonymous
    April 05, 2010
    I have this same problem except I'm using 2005 and IIS 6

  • Anonymous
    April 23, 2010
    Thanks REALLY works for me !!!  

  • Anonymous
    April 23, 2010
    Thanks for your help. farzin.tarat@gmail.com

  • Anonymous
    May 11, 2010
    AWESOME, thank you! Worked like a charm!

  • Anonymous
    August 10, 2010
    great post, saved me a ton of time.!

  • Anonymous
    September 13, 2010
    Thank you. Appears to have solved a problem we've had, too.

  • Anonymous
    March 13, 2011
    thanks for your help! I have been struggling for two days now and this solved my issue!

  • Anonymous
    April 13, 2011
    When I added the entry in the web.config file the webserver returned Http500 error, any ideas why anyone :-)

  • Anonymous
    June 07, 2011
    Wow, you save my life with this problem, I owe you my lilfe.

  • Anonymous
    June 22, 2011
    Thanks Yaar after two days of struggling now able to solve itr....

  • Anonymous
    July 31, 2011
    Thanks this post helped me resolving this problem.

  • Anonymous
    September 06, 2011
    Thanks a lot sir. You realy help me in short time .but this apply only for production server that is windows server 2008 R2.Again thanks