Freigeben über


Report Viewer Throwing a 404 Error on Printing or Export

I had a case recently that was peculiar to say the least and took some interesting troubleshooting, to resolve.  The issue was as follows;
My customer was hosting the Report Viewer control in a site in IIS and when they tried to print or export a report it intermittently failed with an HTTP404 error.

We took network traces, reviewed the IIS logs, a few dumps, reviewed the SSRS logs too and the cause of the 404 eluded us.  The break through came when I noticed that the format of the 404 page matched that of IIS which showed that the error was coming from IIS rather than the Report Viewer control or SSRS itself.  From there we enabled the developer tools within IE (hit F12) and performed a network trace for the browser session alone while reproducing the issue.

After no small amount of trial and error we discovered that the issue related to the size of the query that was being passed to IIS, this was after a few hours which involved copying and renaming the reports to have differing lengths of path and filename.  The length of the query was below that which SSRS can handle (260 characters) and the error being thrown by IIS led us to look at filters in IIS.  My customer then dug into their IIS configuration further and discovered that though there were no filters enabled there was a maximum query length set of 256 characters.  After increasing this to 2048 the issue was resolved.

To check this setting, open IIS Manager and navigate to the "features view" for the site you are hosting the Report Viewer control in then double click on "Request Filtering".  Click on the "Rules" tab and then "Edit Feature Settings" and you should find the "Maximum Query String" setting there.  Increase the number and you should see this issue resolved.

Jason