Friday, 20 April 2012

How IIS processes ASP.NET request?

Before understanding the full flow, we have to go through following concepts:

IIS: IIS (Internet Information Server) is one of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application. IIS has it’s own ASP.NET Process Engine  to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and  process it and send response back to clients.

Worker Porcess (w3wp.exe): Worker Process (w3wp.exe) runs the ASP.Net application in IIS. This process is responsible to manage all the request and response that are coming from client system. In short, Worker process is the heart of ASP.NET Web Application which runs on IIS.

Application Pool: Application pool is the container of worker process. Application pools is used to separate the sets of IIS worker processes that share the same configuration. This makes sure that a particular web application doesn’t not impact other web application.

Note: One Application Pool can have one or many Worker Processes. An application pool with more than one worker process is called 'Web Garden'.

HTTP.SYS Process: HTTP.SYS resides in Kernel Layer of IIS. HTTP.SYS is responsible for pass the request to particular Application pool. It contains the ID of each Application Pool. (Whenever we creates a new Application Pool, the ID of the Application Pool is being generated and it’s registered with the HTTP.SYS).

WAS (Web Admin Services): WAS resides in User Layer of IIS. It takes the request from HTTP.SYS and pass it to the respective application pool.

ISAPI extensions: ISAPI extensions are the IIS way to handle requests for different resources. Once ASP.NET is installed, it installs its own ISAPI extension (aspnet_isapi.dll) and adds the mapping into IIS.

Note: Sometimes if we install IIS after installing asp.net, we need to register the extension with IIS using aspnet_regiis command.

Flow of ASP.NET Request:

1. Client Request hits the web server. Internally this request comes to Kernel Layer of IIS means at HTTP.SYS.

2. HTTP.SYS indentifies the name and ID of Application Pool for that ASP.NET Request.

3. Now Request comes to user level of IIS. WAS (Web Admin Service) puts the request from HTTP.SYS to Application Pool.

4. When Application pool receive the request, it simply pass the request to worker process (w3wp.exe).

5. The worker process “w3wp.exe” looks up the URL of the request in order to load the correct ISAPI extension (aspnet_isapi.dll).

6. ISAPI creates an HTTPRuntime Object to Process the request via HTTPModule and HTTPHanlder.HTTPRuntime is an entry point of the application.

Note: After these steps, After that the ASP.NET Page LifeCycle events starts.

Conclusion:

HTTP.SYS  (Kernel Layer) --> WAS (Web Admin Services) (User Layer) --> Application Pool --> Worker Process (w3wp.exe) --> ISAPI Process (aspnet_isapi.dll) -->  HTTPRuntime Process

4 comments:

  1. 1. who starts the worker process?
    2. How http.sys knows to which app pool I need to transfer request.
    3. Who starts and manage the AppPool?
    4. How IIS runs and who starts it?
    5. Please go into more low level?
    6. don't try to make ur site popular hiding real details. please!!!

    ReplyDelete
  2. 1. WAS starts the worker proces
    2. WAS reads applicationHost.config at startup, and configure the http.sys, by this way, it registers the so-called UrlPrefix. Http.sys gets know what url request should be conveyed to which app pool.
    3. WAS, I think
    4. IIS is a service or a set of services, which can be run with windows start up;
    5. I'm not the author
    6. ...

    ReplyDelete
    Replies
    1. This is some steps

      1. who starts the worker process?
      2. How http.sys knows to which app pool I need to transfer request.
      3. Who starts and manage the AppPool?
      4. How IIS runs and who starts it?
      5. Please go into more low level?

      Delete
  3. www.easyyar.com is a best jobs site, Search for Job Vacancies IT, Software, Govt., Technical and other jobs.Post your resume now and get your first dream job!

    http://www.easyyar.com

    ReplyDelete