23 January, 2012

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


Few days ago I found an error when tried to export about 500 reports to pdf.  The error is Sys.WebForms.PageRequestManagerTimeoutException The server request timed out. This is not found as exception. It is found on run time as javascript error.  I was working on Ajax Control tool kit 3.5. It is occurred because export operation of 500 reports to pdf were relatively long time than default
AsyncPostBackTimeOut.
How to solve this problem?
AsyncPostBackTimeOut is a property of ScriptManager of Ajax. You can change time out length. To solve this problem I have increased the time out of AsyncPostBackTimeOut property.

For example, for exporting 100 pdf I need 20 minutes. So, I will use maximum time out limit 20 minutes which is exactly 1200 seconds. My code is like below.

<asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeOut="1200" >
asp:ScriptManager> 

**The default value of the AsyncPostBackTimeOut property is 90 seconds.
For long time running method (Suppose a method will run for more than 90 seconds), you should use web service by setting timeout (number of seconds) of that web method by Javascript.

No comments:

Post a Comment