Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Standard Async Controller not working on Epi 10

Vote:
 

Hey guys, 

Okay, I have a controller that inherits from just the base Controller, not Epi PageController. It’s a controller for a backend process that we display on the /episerver pages. My broken controller is AdminUserToolsController.cs

I have an ASYNC action method. IT FAILS every time with this:

[InvalidOperationException: The asynchronous action method 'ResendConfirmEmailCompleteAction' returns a Task, which cannot be executed synchronously.]
System.Web.Mvc.Async.TaskAsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +119
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.b__12() +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +256
System.Web.Mvc.<>c__DisplayClass17.b__14() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +256
System.Web.Mvc.<>c__DisplayClass17.b__14() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +256
System.Web.Mvc.<>c__DisplayClass17.b__14() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +522
System.Web.Mvc.Controller.ExecuteCore() +98
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +181
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +40
EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +24
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +443
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163

The ACCOUNT controller that basically “came out of the box” works FINE and it’s async. It has MANY ASYNC methods. But, I can’t seem to use my OWN async controller action.

Why? What am I doing wrong?

#193938
Jun 07, 2018 21:32
Vote:
 

Hi Paul

The key part of the trace is this:

EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller) +40

It looks like Episerver is trying to process your controller. Have you registered a route for your controller? This should exclude Episerver from processing your controller.

David

#193940
Jun 07, 2018 23:19
Vote:
 

NAH HA!

Nope, I hadn't thought about it needing a special route! But, that makes perfect sense!

Our partner had been doing most of our Epi code work while I took care of all the legacy interactions with our protected backend systems! So this was my first foray into our Epi code base.

So it makes sense what you say that in the case were I don't want Epi to consider this controller that just produces non-Epi pages, I should have a route for it just like the Account Controller probably does.

#193954
Jun 08, 2018 13:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.