I'm trying to get execution timeouts working in ASP.NET MVC.
I have read that the execution timeout is only evaluated every 15s and only when compilation debug="false"
, http://blogs.msdn.com/b/pedram/archive/2007/10/02/how-the-execution-timeout-is-managed-in-asp-net.aspx.
However I cant seem to get it to ever trigger a timeout.
I have a basic MVC application (off the template) and have made the following changes:
web.config:
<compilation debug="false" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" executionTimeout="1" />
HomeController:
public class HomeController : Controller
{
public ActionResult Index()
{
Thread.Sleep(20000);
throw new Exception("Shouldnt get here as its longer than the execution timeout +15s");
}
}
If the execution timeout is 1s and im sleeping for 20s in the controller it should always exceed the timeout (max of 16s), but when i run the application I always hit my exception.
What do I need to do to get the thread to abort when it exceeds the timeout?