The working of Asynchronous Controllers is when users send a request to Asynchronous Controllers the asp.net will provide a thread from Thread pool to handle the request. If the request is small then it will process in normal way but in case if processing is taking too much time to complete then it will return process to thread pool for handling other request and whenever the asynchronous operation is complete, it informs ASP.NET then asp.net gets a worker thread from the thread pool (which might be a different thread from the thread that started the asynchronous operation) to process the remaining of the request, including rendering the response.
The convention required to follow when using Asynchronous Controllers. We have 2 Methods of Asynchronous Controllers
1. Async
2. Completed
Async
The async method will return void and it starts the asynchronous process. The syntax of the async method in asp.net MVC like as shown below
Action Name Async
Completed
This method is called when the asynchronous process is complete. The syntax of the Completed method in asp.net MVC like as shown below
Action Name Completed
We will learn these methods in detail with simple Examples. In this example we used web service (Weather service) in IndexAsync method in which we created a proxy client which will take Country name as input and will Return Cities then we will store cities in TempData["ListofCities"] when process will complete then it will call IndexCompleted() Method from which we will display result on view.
Liked By
Write Answer
How do Asynchronous Controllers work in Asp.Net?
Join MindStick Community
You have need login or register for voting of answers or question.
Shikhar Arora
18-Dec-2019The working of Asynchronous Controllers is when users send a request to Asynchronous Controllers the asp.net will provide a thread from Thread pool to handle the request. If the request is small then it will process in normal way but in case if processing is taking too much time to complete then it will return process to thread pool for handling other request and whenever the asynchronous operation is complete, it informs ASP.NET then asp.net gets a worker thread from the thread pool (which might be a different thread from the thread that started the asynchronous operation) to process the remaining of the request, including rendering the response.
The convention required to follow when using Asynchronous Controllers. We have 2 Methods of Asynchronous Controllers
1. Async
2. Completed
Async
The async method will return void and it starts the asynchronous process. The syntax of the async method in asp.net MVC like as shown below
Completed
This method is called when the asynchronous process is complete. The syntax of the Completed method in asp.net MVC like as shown below
We will learn these methods in detail with simple Examples. In this example we used web service (Weather service) in IndexAsync method in which we created a proxy client which will take Country name as input and will Return Cities then we will store cities in TempData["ListofCities"] when process will complete then it will call IndexCompleted() Method from which we will display result on view.