Posted By : Murugan Andezuthu Dharmaratnam
Posted On : 21 January 2015
Keywords : Asynchronous Controller, Asynchronous Controller MVC, Asynchronous Controller ASP .Net MVC, Asynchronous Controller In ASP NET MVC

Asynchronous Controller In ASP.NET MVC

Asynchronous Controller - Introduction



The asynchronous controller enables you to write asynchronous action methods. It allows you to perform long running operation(s) without making the running thread idle. It does not mean it will take lesser time to complete the action. If a request make a service call that require two seconds to complete it, the request will take two seconds whether it is performed synchronously or asynchronously. However, during asynchronous call, the server is not blocked from responding to the other requests.


Create Asynchronous Controller


  • Inherits MVC controller with AsyncController instead of Controller.
  • With the synchronous call, if the calls are made asynchronously (in parallel), total response time would be slightly more than 700 milliseconds, because that is the duration of longest task/operation.


This is a sample code to describe how an Asynchronous Controller will works.






Asynchronous actions are performed in the following scenarios :


  • The operations are simple or short-running.
  • Simplicity is more important than efficiency.
  • The operations are primarily CPU operations instead of operations that involve extensive disk or network overhead. Using asynchronous action methods on CPU-bound operations provides no benefits and results in more overhead.


This figure shows the , From a higher level how ASP.NET MVC processes a request using the controller




When the browser passes a request, The controller will take care of the process ,the request is routes to the controller.The response is again back to browser after the process is done.







Murugan Andezuthu Dharmaratnam

Murugan is a technology leader with 14 years of hands-on experience in full life cycle systems design, development, implementation, and management. In addition to systems design and development, his core competencies include cloud design and architecture, interactive web applications and websites development, mobile computing, and Healthcare Information Technology. His experience is very diverse with a broad range of technologies within multiple industry settings including private, public, and non-profit. Coupled with his technology expertise, Murugan is a well-organized, result-oriented, and a highly analytical leader with proven track record in developing and implementing very complex systems.