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.
<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
Comments
Anonymous
January 14, 2009
The comment has been removedAnonymous
January 22, 2009
Create empty file in notepad and save it under the name Reserved.ReportViewerWebControl.axd into folder containing Web.config.Anonymous
January 29, 2009
Your blog cuts off a large portion of the code can you please post an entry with the full code for the handlers?Anonymous
January 29, 2009
Mike I have added scroll bars around the code block. Hope it helps.Anonymous
January 29, 2009
Thanks. I tried to drop that into my code but no fix. I know it applied to IIS 7.0 & I am running IIS 5.1 on XPSP2 with VS 2K8 and I am still getting the same thing. Thanks for the scroll bars guess I will be back to the drawing board till I find a fix... If you have any ideas as to why I am getting the same error but on a different platform please feel free to shoot me a message trigeek512 at gmail dot com! Thanks & keep up the good work.Anonymous
February 10, 2009
I was recently working on a reporting web application that uses the Report Viewer ( ReportViewer ) controlAnonymous
February 26, 2009
Thank very much. reslove my problem.Anonymous
March 31, 2009
Thank you. This solved my problem.Anonymous
April 21, 2009
Thank you. Solved my problem :)Anonymous
May 21, 2009
The comment has been removedAnonymous
June 12, 2009
The comment has been removedAnonymous
October 15, 2009
Hi.. I was experiencing the same problem of the missing icons and report not rendering with ReportViewer 8.0 connecting to SSRS 2008 and IIS7. The above fix didn't solve the problem for me unfortunately. Does anyone think that the versions are incompatible...? Thanks in advance!Anonymous
October 15, 2009
Fixed!! It was the missing 'name' attribute and offending 'validate' attributes in my entry that was causing the issue. So in conclusion, ReportViewer 8.0 does work with SSRS 2008 effortlessly! Great post .. many thanks!Anonymous
November 12, 2009
What a beauty. It just worked adding the comments.Anonymous
December 02, 2009
Thanks so much! You saved me hours of troubleshooting!Anonymous
December 09, 2009
Can you think of any situations that would cause the same exact behavior even after following these steps? Our rdls have to remain as 2005 versions so all your steps were followed except the version is 8.0 instead of 9.0 everywhere in the web.config. This has worked in many prior installations on different customers, but this time it does not change things the images are still missing and the entire toolbar does not work because of JS errors. I have also run the Microsoft fix for the 2005 ReportViewer Redistributable on the web and report server boxes but that didn't change the above either. (http://www.microsoft.com/downloads/details.aspx?familyid=82833F27-081D-4B72-83EF-2836360A904D&displaylang=en).Anonymous
December 20, 2009
These suggestion are very usefullAnonymous
December 24, 2009
Wonderful. Report Viewer was giving headache on production host. Made that addition and it worked. ThanksAnonymous
January 11, 2010
Heelo, I have developed RDLC report that can export in pdf and excel in mozila but not in IE. In IE give a following error. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /Reserved.ReportViewerWebControl.axdAnonymous
January 27, 2010
The comment has been removedAnonymous
January 28, 2010
Thanks a lot for this solution. It made no sense to me, that part of the remote report was displayed and not images and part of the dropdown did not display.Anonymous
February 01, 2010
This is unbelievable, I spent days trying to figure this out. The thing that did the trick for me at the end was to create the empty control file on the root as one of the comments suggested...Anonymous
February 22, 2010
Worked a treat for me, thanks for this!Anonymous
March 17, 2010
More things to know. Check it here. http://praveenbattula.blogspot.com/2010/03/fix-to-report-viewer-problems-in-iis-7.htmlAnonymous
April 12, 2010
Great work, thanks a lot. It saved a lot of time.Anonymous
April 13, 2010
Thanks a lot its working for me in the Live.Anonymous
April 15, 2010
This worked for me - thanks! One problem I still have is the dropdown menus are locked for export format, page size and any parameter lists. May be a separate ajax issue.Anonymous
June 03, 2010
Congrats, you've saved another developer! Many thanks!Anonymous
August 04, 2010
Thanks alot , Mr. Vijay, It worked fine.Anonymous
December 16, 2010
The comment has been removedAnonymous
January 03, 2011
Great Help maan .... tahnks a toN :)Anonymous
January 17, 2011
This is a great work.Thank for thisAnonymous
November 29, 2011
Very cool solution... Tnx buddy....Anonymous
December 22, 2011
After do it, I receive a another error: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.Anonymous
May 02, 2012
After doing steps above my report is still not working. Please let me know what did I missed? Thanks.Anonymous
August 10, 2012
Friend, I have to thank you because you saved my life!! I was having a big problem to render the reportviewer version 9.0 in IIS 7.5, IIS 6 could usually, but not working in IIS 7.5. When I added the tag described by you in <handlers> everything was resolved. Thank you very much.Anonymous
November 29, 2012
The comment has been removedAnonymous
January 09, 2014
You are friggin awesome. This worked like a charm.Anonymous
January 14, 2014
The comment has been removedAnonymous
January 22, 2014
Check the application pool of the website. it should be class.net if you are using RLDC report viewer.Anonymous
June 09, 2014
Thanks alot, this works like charm.Anonymous
September 07, 2014
Great help! Worked for me. As someone else said, the pic at the top of the blog with the broken toolbar is a gem - you instantly know this iw what you're looking for. Thanks.Anonymous
October 06, 2015
I have windows 7 and the report viewer stops me from opening some things in the search bar. I do not like the report viewer. Is it a must have or can I disable it?