I was working on a particular production problem yesterday. Sometimes when a user clicked on print button in SSRS Web Report Viewer control, and error was shown, and report is only partially printed, maybe 2 pages out of 4 are printed. Specific error that is shown to the user stated “An error occurred during printing (0x80004005)”.
Don’t you hate problems that start with “it only breaks sometimes”? Moreover, those that have totally nondescript errors?
One thing I learned a while ago, is that is web farm environment these types of problems are often related to configuration issues on one server vs. the other. So, I took a look at all the servers, and they all had SSRS Report Viewer redistributable installed. What was also interesting, is that preview worked fine, the error only occured when print button is pushed.
It took me a bit to replicate the problem, and then I did what I often do when debugging web problems – I fired up Fiddler. What Fiddler was reporting is that I was getting 404 Not Found error for Reserved.ReportViewerWebControl.axd. I could not understand why because report viewer redistributable should have installed the HTTP handler for me. I checked first production machine, and it was there. So, I checked the rest of the production servers. I found one that was missing the handler. No idea why, the same install was run on all the servers.
So, I added the handler in IIS 7 Management IIS Console -> root server node -> Handler Mapping -> Add Managed Handler with the following entries:
Request Path: Reserved.ReportViewerWebControl.axd
Type:Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Name=ReportViewerWebControlHandler
Note: I am using SQL Server 2008 R2, hence the assembly version is 10.0
And voila, the problem went away!
Thanks.