How to install and configure IIS on Windows Server 2012 R2?
In this blog, I will discuss on how to install and configure IIS on Windows Server 2012 R2 and what is a web server and IIS. There’s no much difference between the two procedures. The installation is quick and easy. Don’t believe me? Well, don’t worry! Below is a step-by-step guide to make things sound easy and sorted…
Step one: Install the Web Server (IIS) role.
Open the Server Manager and click Add Roles and Features as shown below:
Go on until you reach the Server Roles tab.
Now select the Web Server (IIS).
After selection of web server, click Add Features.
Ignore the Features tab and go on.
Now click Next.
The default configuration will be fine. Click Next.
Step two: Configure IIS.
Go back to the Server Manager. Select Internet Information Services (IIS) Manager from the Manage menu.
Click Add Website.
Specify at least the site name and path. Click Ok.
What is Web Server?
IDE, Vs integrated ASP.Net Engine, is responsible for executing every time of asp.net request and response whenever we run our ASP.net web application. The process name is “WebDev.WebServer.Exe” which takes care of all request and response of a web application which is running from Visual Studio IDE.
When we want to host the application on a centralized location the name “Web Server” comes into the picture and wanted to access from many places. The web server is responsible for handling all the requests that are coming from clients, process them and provide the responses.
What is IIS?
One of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application it is called Internet Information Services (IIS). IIS has its own ASP.NET Process Engine to handle the ASP.NET request. Now, IIS took the coming request and it processes the request on server and send response back to clients
Request Processing in web server
So far it’s clear to you that what is the Web server and IIS is and what is the use of them. Now let’s have a look how the request is processing internally. Moving ahead, you have to know about two main concepts:
1. Worker Process
2. Application Pool
The asp.net application in IIS is used to run by the Worker Process (w3wp.exe). For all the request and response that are coming from the client system, This w3wp.exe process is responsible for managing. All the ASP.Net functionality runs under the scope of the worker process. Whenever the client request generates to the server from a client worker process is responsible for generating the request and response. In simple words, we can say worker process is the heart of ASP.NET Web Application which runs on IIS.
This is the container of the worker process. These application pools are used to separate sets of IIS worker processes that share the same configuration. Application pools provide a better security, reliability and availability for any web application.
When multiple worker processes with Application Pool it is called “Web Garden.”
Till now, I have covered all the basics of the Web server, Application Pool, Worker process. Now we move to, how IIS process the request when a new request comes up from a client.
Now I move to IIS 6.0 Architecture, basically, IIS 6.0 Architecture divide them into Two-Layers:
1. Kernel Mode
2. User Mode
HTTP.SYS contains in kernel mode and this kernel mode introduced with IIS6.0. So the client makes a request from Client to Server, then HTTP.SYS hit First.
Now, HTTP.SYS is Responsible for pass the request to the particular Application pool. Here the big question arises that how HTTP.SYS does come to know where to send the request. Whenever we create new Application Pool, the Application Pool is being generated own ID, and it’s registered with the HTTP.SYS.
So, it is the first step of IIS Request Processing architecture.
The second step of IIS Request Processing architecture:
So far, Client Requested for some information and request came to the Kernel level of IIS means at HTTP.SYS. HTTP.SYS has been identified the name of the application pool where to send. Now, we move to the next, how this request moves from HTTP.SYS to Application Pool.
In the user level IIS have Web Admin Services (WAS) and WAS takes the request from HTTP.SYS and pass to the application pool.
After above process Application pool receives the request, it just passes the request to worker process (w3wp.exe). The “w3wp.exe” looks up the URL of the request to load the correct ISAPI extension. The ISAPI extensions are the IIS way to handle requests for different resources. When ASP.NET is installed, it is installed the own ISAPI extension (aspnet_isapi.dll) and its mapping adds into IIS.
When aspnet_isapi.dll loads using worker process, the HTTP Runtime start automatically, which is known as the entry point of an application. HTTP Runtime is a class which calls the Process Request method to start Processing.
When this method called, a new instance of HTTP Context is created. Which is accessible using HTTP Context.Current Properties. This object always remains same at the end of this object request life. We can access some other objects using Http Context.Current like Request, Response, Session, etc.
After that Http Runtime load, an Http Application object with the help of Http Application Factory class.
Now, the new concept is introduced called “HTTP Pipeline.” this concept is called a pipeline because it contains a set of Http Modules that intercept the request on its way to the Http Handler. The incoming request that has access to classes HTTP Modules. We can also create our HTTP Module if we need to handle anything during upcoming request and response.
When the user creates the request the web page from a web server, the first request reaches to HTTP.SYS of IIS. Then HTTP.SYS send the request to the particular Application Pool. Then Application Pool forwards the request to worker process to load the ISAPI Extension which will create an HTTP Runtime Object to Process the request via HTTP Module and HTTP handler. After the process, the ASP.NET Page Life Cycle event starts!