2

I have an ASP.NET page with several static methods decorated with [WebMethod] in the code-beside, which in turn are called from javascript using PageMethods.MyMethodName(myParameter, myOnCompleteHandler, myOnErrorHander);.

One of the methods is called multiple times, and the runtime can be long due to the volume of calls. Currently, the method is functioning correctly, but calls that take >5 minutes to complete are timing out. I would like to increase that span to 10 minutes.

I have tried:

  • ScriptManager.AsyncPostBackTimeout = 600;
  • Server.ScriptTimeout = 600;
  • this.Page.AsyncTimeout = new TimeSpan(0,10,0);
  • Sys.Net.WebRequestManager.set_defaultTimeout(600000); in javascript
Forgotten Semicolon
  • 13,909
  • 2
  • 51
  • 61

2 Answers2

2

Add the following line to your web.config in the system.web section.

<httpRuntime executionTimeout="3600" maxRequestLength="2147483647" />

Late response, but maybe this will help the next person.

hardba11
  • 1,478
  • 15
  • 27
  • executionTimeout controls the http runtime's execution timeout on the server before which it will throw the http runtime timeout exception. – Moiz Tankiwala Dec 27 '16 at 06:21
1

The correct answer is here as the AJAX timeout is control by the script manager not the http execution timeout.

You need to get hold of the scriptmanager control (either in code or markup) and set the AsyncPostBackTimeout property to a suitable value as you desire.

AsyncPostBackTimeout="300"
Community
  • 1
  • 1
Moiz Tankiwala
  • 6,070
  • 7
  • 38
  • 51