How IIS Web Server Process Request In Windows Dedicated Server ?

Windows Dedicated Server is installed with one of the most popular IIS web server. It is very powerful to handle asp.net application and other request. When a request comes from the client and servers do lot of process before it respond back to the client. We can see the article below about how IIS handle the request.

What is Web Server ?

The development of local application in .net uses a process name “WebDev.WebServer.exe” which handles all the request and provide the response the web application. When you need to handle the application in centralised place and access the application from many places the “Web Server” comes into the picture. Web Server is responsible for all the requests that are coming from clients and process them and provide the response back to the clients.

IIS Web Server

Internet Information Services – IIS is one of the most powerful web servers from microsoft to handle asp.net web application. There are two important concepts while understanding on IIS. They are application pool and worker process.

Worker Process (w3wp.exe) is main responsible component for handling all the request and response that are coming from the client. w3wp.exe generates the request and response.

Application pool contains worker process. This separates the IIS worker process for different application. So the resources shared by each application can be separated. It will lead to better security and provide high performance for the web application. Even one application consumes higher resources then other application will not be affected because of it.Multiple worker process inside the same application pool is called Web Garden.

How IIS process the request ?

In previous architecture there are two modes in IIS. Kernel mode and User Mode.

Kernel Level

When a request comes from client to server, it hits https.sys first. HTTP.SYS is responsible for the request to pass to the particular application pool. When the application pool is created, it will have ID generated for each application. These IDs will be registered in HTTP.SYS. Using that it will collect the request for the proper application pool.

User Level

From http.sys the request is taken by WAS [ Web Admin Services ] and forward that to application pool. When application pool receives the request it passes the request to w3wp.exe. Worker process check the URL and load the proper ISAPI extention. ISAPI extensions are the IIS way to handle the request for different resources. For ASP.NET application it has its own ISAPI extention [ aspnet_isapi.dll ] and adds the mapping into the IIS.

  1. When Worker process loads the aspnet_isapi.dll, it starts an HTTPRuntime, which is the entry point of an application. HTTPRuntime is a class which calls the ProcessRequest method to start Processing.
  2. When this method called, a new instance of HTTPContext is created. Which is accessible using HTTPContext.Current Properties. This object remains alive during the life time of object request.
  3. Every request should pass through the corresponding HTTPModule to reach to HTTPHandler, this list of a module is configured by the HTTPApplication. HTTPModules are classes that have access to the incoming request.
  4. HTTP Handlers are the endpoints in the HTTP pipeline. All request that is passing through the HTTPModule should reach to HTTPHandler. The HTTP Handler generates the output for the requested resource. So, when we were requesting for any aspx web pages, it returns the corresponding HTML output.
  5. All the request now passes from httpModule to respective HTTPHandler then the method and the ASP.NET Page life cycle starts. This ends the IIS Request processing and starts the ASP.NET Page Lifecycle.