Murdock
Murdock

Reputation: 4662

How are asynchronous controller actions processed by the MVC framework?

How does MVC handle controller actions that return a task. ie what is the difference between

public async Task<ActionResult> MyAction()

and

public ActionResult MyAction()

in the way that MVC process it (I do not want an explanation of the difference between these methods in general, only in the context of how the result of these methods is used to create the view for example)

Edit: I don't see any difference in the views that use it. ie there is no indication that it is handle differently. How does MVC handle it internally?

Upvotes: 1

Views: 291

Answers (1)

Stephen Cleary
Stephen Cleary

Reputation: 457017

Internally, MVC will (asynchronously) wait for the returned task to complete before sending the response.

Upvotes: 2

Related Questions