Life Cycle
MVC Life Cycle Overview
Â
In this chapter, we explore the MVC processing pipeline and follow the journey of an HTTP request as it moves through the ASP.NET MVC framework.
At a basic level, a life cycle refers to a sequence of steps or events that occur to handle a request or to manage changes in an application’s state. This concept is not unique to MVC—you may already be familiar with it from other frameworks.
For instance, ASP.NET Web Forms has a detailed page life cycle, while platforms such as Windows Phone applications also have their own application life cycles. Regardless of the technology, understanding how a framework processes requests helps developers use it more effectively—and MVC follows the same principle.
Types of MVC Life Cycles
ASP.NET MVC defines two major life cycles:
Application Life Cycle
Request Life Cycle

Â
The Application Life Cycle
Â
The application life cycle refers to the time at which the application process actually begins running IIS until the time it stops. This is marked by the application start and end events in the startup file of your application.
The Request Life Cycle
Â
It is the sequence of events that happen every time an HTTP request is handled by our application.
The entry point for every MVC application begins with routing. After the ASP.NET platform has received a request, it figures out how it should be handled through the URL Routing Module.
Modules are .NET components that can hook into the application life cycle and add functionality. The routing module is responsible for matching the incoming URL to routes that we define in our application.
All routes have an associated route handler with them and this is the entry point to the MVC framework.

The MVC framework handles converting the route data into a concrete controller that can handle requests. After the controller has been created, the next major step is Action Execution. A component called the action invoker finds and selects an appropriate Action method to invoke the controller.
After our action result has been prepared, the next stage triggers, which is Result Execution. MVC separates declaring the result from executing the result. If the result is a view type, the View Engine will be called and it's responsible for finding and rending our view.
If the result is not a view, the action result will execute on its own. This Result Execution is what generates an actual response to the original HTTP request.