Introduction to IIS
There are a lot of organizations that conduct their day to day businesses through the internet. These organizations try to expand digitally to reach out to as many people as possible to increase their sales and revenue. But to conduct business online, organizations need to share their information digitally through the internet and web applications help these organizations to do that.
A web application is nothing but a computer program that uses browsers and other web technologies to perform various tasks over the internet. To deploy and host web applications over the internet, you need the help of a web server.
Today, we are going to deep dive and understand a particular type of web server called IIS. It is a highly accessible web server from the house of Microsoft. But first, we are going to answer some important questions like what is IIS and how it is useful for your business.
Table of content
- What is IIS?
- Architecture of IIS
- Handling Request in IIS
- Advantages of IIS
- Setting up IIS
- Wrapping Up
What is IIS?
IIS stands for Internet Information Services. It is a web server by Microsoft which runs on the .NET platform. It is widely used to host ASP.NET web applications and to handle requests. It has its own process engine.
Architecture of IIS
The main components of IIS are:
Worker Process: In IIS, the Worker process runs the web application. The Worker process is a client connection handling system. It manages the request and the response that is communicated between the client systems. When a web server receives a request from a client, the request and response are generated by the worker process.
Application Pool: The Application pool is a group of worker processes. It is used to containerize the worker process having the same configuration. The web application becomes more secure, reliable, and available thanks to application pools.
Application pools are mutually exclusive which means if any worker process is facing an issue, the application pool makes sure that the other pools are not affected. This has an important benefit. The downtime in one web application will never affect the other applications since they are configured in different application pools.
IIS applications also have advanced settings like auto restarting, auto-shutdown of the processes. This impacts the behavior of the worker process. Application pool can also run with multiple IIS worker processes also known as a web garden.
Handling Request in IIS
The IIS architecture can be divided into two layers: Kernel Level Layer and User Level Layer.
Kerner Level Layer contains the HTTP.SYS, that is triggered when a request comes to the server from the client. It is responsible for selecting the application pool for the request. This identification of the application pool is done with the help of a unique ID for the application pool which gets registered with HTTP.SYS whenever a new application pool is created. Kernel Level Layer is only responsible for identifying the application ID for the request.
The second layer is User Level which contains Web Admin Services. HTTP.SYS passes the request to Windows Activations Services which in turn forwards the request to the application pool. As you know the application pool consists of worker processes. This means it can identify the process to which the request belongs, and passes it to that worker process. When the request reaches the worker process, it loads the ISAPI extension by referring to the URL of the request. ISAPI extension is installed by ASP.NET and gets registered into IIS. Different resources are handled by IIS with help of the ISAPI extension.
Worker process loads the HTTPRuntime. It is an entry point for the application and calls the ProcessRequest method to initiate request processing. ProcessRequest creates an instance of HTTPContext which remains alive throughout the request lifecycle. We can access objects like request, response, session, etc using the HttpContext.Current property.
Advantages of IIS
- IIS has a very low deployment cost. It does not require any dedicated software and can be run via a web browser.
- IIS applications are supported by a long list of browsers and operating systems giving opportunities for more users.
- The core of IIS can be manipulated by the user with the help of object models provided by the framework of active server pages. This in turn lets the user retrieve data from a web browser.
- The code is not embedded in the document which gives the user more security. Writing and debugging of code can be separated from developing and designing the User Interface.
- The database can be used to manage the state between the server and the client.
Setting up IIS
Windows by default comes with an IIS feature that can be enabled if required. Start by pressing the Windows key or by clicking the bottom left button and searching for “Turn Windows features on or off”.
Click on it. This will open the “Windows Features” screen. By default, the Internet Information Services option is disabled.
As a beginner, you can just enable the whole module but if you want to go deeper, then navigate to Internet Information Services > World Wide Web Services > Application Development Features, which is the subdirectory where CGI, WebSocket Protocol, ASP.Net can be individually enabled. Click on the checkbox against it to have a tick mark and press “Ok” to confirm the changes. This will begin the installation. After completion of the installation, you can access the IIS GUI which will look like something like this -
Any web application that you build needs hosting. Thanks to Microsoft we have one of the most accessible web servers sitting right inside our Windows system. The low deployment cost and support for almost every browser known on this planet make IIS a compelling web server to use.