Increasing Timeout Values in ASP.NET MVC 3

asp.net-mvc-3

Solution

If you need do some task that you know can take a little while would be nice use AsyncControllers, and you can set diferent timeout betwen actions

for example

[AsyncTimeout(3000)] //timeout in miliseconds
public void DoTaskAsync(){

//something that takes a long time
 AsyncManager.Parameters["result"] = contentresult; //Contentresult is your data result of process

}
public ActionResult DoTaskCompleted(String result){
   return json(result);
}

http://msdn.microsoft.com/en-us/library/ee728598.aspx#Y4400 for details...

otherwise... `HttpContext.Server.ScriptTimeout = 3000;`

Problem

I have a JSON service that I'm exposing via ASP.NET MVC 3. This service is exposed as an Action on a Controller. I can successfully call the action. However, occasionally, the action takes too long to complete. Because of that, my caller fails due to a timeout. My question is, how do I change the timeout threshold's in ASP.NET MVC 3.

Original source