I am using MVC4 with VS 2010. I have an async action that I am trying to get working. My controller inherits from AsyncController and I have the ~Async and ~Completed methods. I am able to execute my async action correctly in a sample test project. But when I run it as part of my core web app it get this exception
[InvalidOperationException: The asynchronous action method 'Complete' cannot be executed synchronously.] System.Web.Mvc.Async.AsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +133 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +39
I am using Unity for Dependency Injection, ActionAttributeFilters and MVCSiteMapProvider, I am wondering if one of these is causing the above issue. Any help is appreciated.
Thanks
The whole stack trace
[InvalidOperationException: The asynchronous action method 'Complete' cannot be executed synchronously.] System.Web.Mvc.Async.AsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +133 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 System.Web.Mvc.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() +129 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +978122 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +978400 NotFoundMvc.ActionInvokerWrapper.InvokeActionWith404Catch(ControllerContext controllerContext, String actionName) in c:\Users\Andrew Davey\projects\opensource\NotFoundMvc\src\NotFoundMvc\ActionInvokerWrapper.cs:40 NotFoundMvc.ActionInvokerWrapper.InvokeAction(ControllerContext controllerContext, String actionName) in c:\Users\Andrew Davey\projects\opensource\NotFoundMvc\src\NotFoundMvc\ActionInvokerWrapper.cs:21 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +40 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +67 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +53 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +20 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +53 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375