Do you have to inherit from AsyncController when you're using Async/Await in your controller or will it not truly be asynchronous if you use Controller? How about Asp.net web api? I don't think there is a AsyncApiController. Currently i'm just inheriting from controller and its working but is it truly async?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- MVC-Routing,Why i can not ignore defaults,The matc
- Generic Generics in Managed C++
- How to store image outside of the website's ro
- How to Debug/Register a Permanent WMI Event Which
The XML comment for the
AsyncController
class in MVC 4 saysThe class itself is empty.
In other words, you don't need it.
In terms of Web API, you don't need a Async controller base class. All what you need to do is to wrap your return value in a Task.
For example,
In addition, in .Net 4.5 you can benefit from await-async to write even more simple codes: