ReportViewer 2010 control fails with Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out

Think about a scenario where you have a report that takes more than 90 seconds to complete its operation and give the rendered report back to you. The report renders perfectly as expected when you view it from Report manager (For our convenience lets take that the report takes 120 seconds to come up). Now you want this report to be shown to your clients / users in your custom ASP.NET application.

The obvious choice would be to use ReportViewer 2010 web server control. The ReportViewer Web server control is an ASP.NET AJAX control used to host reports in ASP.NET AJAX projects. You can refer here to read more about this control and how to use them in your projects.

In your project you've dragged and dropped the ReportViewer 2010 web server control along with the AJAX ScriptManager which is required to host the report viewer web server control. Then you point the control to load the above discussed report, as soon as the page gets loaded.

When you browse the ASP.NET page that hosts ReportViewer control, it starts rendering the report by displaying the small green icon "Loading...." in the screen. But to your surprise either you get a JavaScript error message on the screen or a small yellow triangle in the IE status bar with the message Done and there is no rendered report displayed as per your request .

When you look in to the message, it shows similar to the following,

Message: Sys.WebForms.PageRequestManagerTimeoutException: The server request timed out.

If you go to Reporting service executionlog table, again to your surprise it says the report has successfully rendered.

Now what's next is going to be important.

The above error in the browser is caused because of the ScriptManager's AsyncPostbackTimeout. By default it is 90 seconds.

So, all you need to do is, locate the ScriptManager element in your ASPX UI file and change the timeout value to "Do not timeout" as shown below,

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="0" ></asp:ScriptManager> 

Now view the page and the reportviewer web server control should be greatful enough to show you the rendered report.



[All the posts are AS-IS with no warranty]