I have an action as follows:
public async Task<ActionResult> Pair(string id)
{
try
{
DocuSignAPIManager docuSignAPIManager = new DocuSignAPIManager();
DocuSignEsignatureAuthContainer authContainer = await docuSignAPIManager.Pair(User.Identity.Name, id).ConfigureAwait(false);
DocuSignManager.Instance.Pair(User.Identity.Name, authContainer);
}
catch(Exception e)
{
ErrorManager.Instance.LogError(e);
}
return new HttpStatusCodeResult(200);
}
When the action is called all of the logic is executed, however instead of an HTTP Status 200 code, I receive the following:
System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]
For testing I'm just calling the action from a web browser using the following URL:
http://localhost:20551/CharteredSurveyor/Pair/password
I really don't understand what the problem is - can anyone help?
The ErrorHandlingControllerFactory
from ELMAH returns a custom action invoker which it uses to make sure its HandleErrorWithElmahAttribute
is applied to the controller. It never supplies an async action invoker so it doesn't understand async/await.
Two workarounds;
ControllerBuilder.Current.SetControllerFactory(new ErrorHandlingControllerFactory())
and simply add HandleErrorWithElmahAttribute
to the global filters using GlobalFilters.Filters.Add(new HandleErrorWithElmahAttribute());
Cheers, Dean
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With