Getting 404 with Asynchronous Action (Task <ActionResult>)
Very simple, I converted some synchronous login actions to asynchronous and now they are not found, getting 404.
public async Task<ActionResult> BetaLoginAsync()
{
return View();
}
[HttpPost]
public async Task<ActionResult> BetaLoginAsync(Models.Authentication.SimpleLoginModel loginModel, string returnUrl)
{
if (this.ModelState.IsValid)
{
if (await this.ValidateCredentialsAsync(loginModel))
{
...
I thought I did everything I needed, I followed this:
http://www.asp.net/mvc/tutorials/mvc-4/using-asynchronous-methods-in-aspnet-mvc-4
The compiler warns me that the first action method, which only returns the view, does not use the keyword await, so it will work synchronously.
The problem is that when I delete the keyword async, it does not compile at all. The compiler says that the type ViewResultreturned from the call Viewcannot be implicitly converted to a type Task<ActionResult>.
, , HttpPost post-back , MVC , , , !!
, , .
, / ?
- , ?
1
, .
, AsyncController, , MVC 4 +.
AsyncController ASP.NET MVC 4?
MVC 5 . MVC 3 ... .
.
2
, , . async , .
, , , "" AsyncController MVC 3.
, .
. ASP.NET MVC 4, . - ( - "Async" . "Async" , . , , MVC)
, , , , AsyncController, - AsyncController, async. , . , AsyncController , async. AsyncController .
MVC 5, , . , , , . Async MVC .