When you
- are running under webhost
- and have System.Web.Http.dll installed in the GAC
-
and the ASP.NET app is configured to run in Medium trust
then action methods that return Task<TResult> will cause a MethodAccessException. Specifically, this is an issue with the codegen that we use to invoke those types of methods. One possible solution would be to codegen a call to a public method.