Tuesday, January 21, 2014

How IIS process a request

Those who need basic understanding of IIS, please Click Here.
Depending upon the extension, IIS determines the handler. What if the url does not have any extension(case of MVC and webapi). Well in that case the old IIS(5.0,6.0) wont work as expected, but the 7.0 will work.

The difference between 6.0 and 7.0 is, 7.0 by default run in integrated mode. That is, it treats every request to be .NET request and hence it does not need any extension to identify, if it is .NET request or not.

The below diagram gives an overview of how request is handled in IIS.

The request from the browser once reaches to IIS, it resolve the extension(for old IIS) and pass it to the respective handler(aspnet_wp.exe in 5.0 and w3wp.exe in 6.0/7.0).

Once it reaches to these process, it creates object of ApplicationManager, which loads AppDomain(if not loaded) and pass the request to respective appdomain. Application manager is responsible for managing different appdomain in the process.

In the Appdomain, a hosting environment is created, which provides information(like folder where application is, applicationID, sitename etc) about application

Once hosting environment is created, it creates object of HttpContext, HttpRequest, HttpResponse.

After all these objects are created, application is started by creating object of HttpApplication(if global.asax is available, then object of global.asax created which inherits frm HttpApplication only). The HttpApplication will take care of performing ASP.NET life cycle. All the events raised in page life cycle is taken care by HttpApplication. (If it is global.asax, then the event in global file also taken care of.)

Ref -
http://msdn.microsoft.com/en-us/library/ms178473(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/bb470252(v=vs.100).aspx

No comments:

Post a Comment