Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

New Post: Custom IActionInvoker and async Action

$
0
0

I'm using NInject as the default container and the NInjectResolver class on an MVC4 project. Injection works great.

Now I'm trying to replace the default IActionInvoker in order to provide custom JSON serialization as shown here.

This seems to work OK if the action returns JsonResult but it chokes on Task<JsonResult> (even if I bind IActionInvoker to the default ControllerActionInvoker).

When I convert it to an async action, the action returns (instead of JSON), this text: System.Threading.Tasks.Task<System.Web.Mvc.JsonResult> - like calling ToString() on it.

How do I go about fixing this?

This is from an unanswered SO question, you're welcome to answer there too if you'd like the added rep: http://stackoverflow.com/questions/12266818/custom-iactioninvoker-and-async-action


Viewing all articles
Browse latest Browse all 7925

Trending Articles