We are getting a TimeoutException on an MVC AsyncController in our Beta HyperV environment. Everything works fine when debugging locally, but when we deploy to the pre-production environment, we get this error:
[TimeoutException: The operation has timed out.] System.Web.Mvc.Async.WrappedAsyncResult`1.End() +129 System.Web.Mvc.Async.<>c_DisplayClass39.b_38(IAsyncResult asyncResult) +23 System.Web.Mvc.Async.<>c_DisplayClass33.b_2d() +125 System.Web.Mvc.Async.<>c_DisplayClass49.b_43() +452 System.Web.Mvc.Async.<>c_DisplayClass49.b_43() +452 System.Web.Mvc.Async.<>c_DisplayClass49.b_43() +452 System.Web.Mvc.Async.<>c_DisplayClass31.b_30(IAsyncResult asyncResult) +15 System.Web.Mvc.Async.<>c_DisplayClass24.b_1a() +31 System.Web.Mvc.Async.<>c_DisplayClass1f.b_1c(IAsyncResult asyncResult) +230 System.Web.Mvc.<>c_DisplayClass17.b_12(IAsyncResult asyncResult) +28 System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +20 System.Web.Mvc.AsyncController.EndExecuteCore(IAsyncResult asyncResult) +53 System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +20 System.Web.Mvc.<>c_DisplayClass8.b_3(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +20 System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136
[OutputCache(Duration = 0, NoStore = true, VaryByParam = "")]
public void IndexAsync()
{
using (var context = Repository.CreateContext().CreateUnitOfWork())
{
user = context.Users.Single(u => u.Username == User.Identity.Name);
AsyncManager.OutstandingOperations.Increment();
ThreadPool.QueueUserWorkItem(o => {
var sync = myService.DoThingsAsync(user);
sync.AsyncWaitHandle.WaitOne();
AsyncManager.OutstandingOperations.Decrement();
});
}
}
/// IndexCompleted is never called
public ActionResult IndexCompleted(string property)
{
using (var context = Repository.CreateContext().CreateUnitOfWork())
{
var user = context.Users.Single(u => u.Username == User.Identity.Name);
var model = new MyViewModel
{
ModelProperty = user.Property
};
return View("Index", model);
}
}
What would be some possible causes of this error?