Introduction
This article explains why we need Async Action Methods in ASP.NET MVC4 Applications.
Consider a situation where you have a traditional ASP.NET web application deployed into your IIS Server. Assume one of your methods in your application's Registration Form has the functionality that may take more than a minute to process the data on clicking the Save button.
You could see the screen is non-responsive and you were blocked from doing actions on other parts of the site after clicking the Save button. This is because your functionality is processed synchronously. This is where we need to use asynchronous programming like async and await.
Before answering the question in the title of this article, let us have a brief intro of async and await.
What is Async/wait?
The async and await keywords were introduced in C# 5.0. async executes a method asynchronously whereas await indicates that the current method is waiting asynchronously for the process/method that needs to complete.
For more detail, please look at these C-SharpCorner Async Articles.
Why do we need Async Actions?
Well, of course you need to have asynchronous action methods when you need a non-blocking responsive UI or your request to an action method has functionalities regarding IO operations or you are providing options to cancel the long running request. To understand more, we will explain how the ASP.NET request will be processed.
In the IIS Web server, the .Net framework manages a thread pool to process the ASP.NET service requests. When the server receives a request, it is assigned to a thread. If the thread processes the request in an synchronous manner, then it can't handle another request that has arrived.
In large applications, if the Web Sever processes the concurrent long-running requests then all the threads may be blocked and the server will reject the request with the HTTP 503 Status, in other words "Server Too Busy".
In this situation, if the Web Server processes the request in an asynchronous manner then the server won't be blocked to process another request, because:
- If the Web server receives a request, then it will be assigned to a thread from the thread pool to handle the request.
- The thread simply initiates an asynchronous operation and returns to the thread pool to service another request.
- When the asynchronous operation is complete, the web server notifies ASP.NET.
- Since the thread is returned to the thread pool, the web server again picks another thread to process the remaining part of the request (rendering the response).
It's always better to explain the article with an example.


juanPosted Jan 7, 2018, 9:10 PM
Hi. In your last image. Are Thread1 and 2 executed by different cores?
Pramod GehlotPosted May 18, 2016, 6:30 AM
Nice Article.Thank You.