IIS 6.0 and ASP.NET, Part 1
IIS 6.0 is the next generation of Web server available in the Windows Server 2003 platform. IIS 6.0 provides several enhancements over IIS 5.0 that are mainly intended to increase reliability, manageability, scalability, and security. IIS 6.0 is a key component of the Windows Server 2003 application platform, using which you can develop and deploy high performance ASP.NET Web applications, and XML Web Services. In this series of articles, we will take a look at the new features of IIS 6.0 such as new scalable HTTP request processing architecture, the ability to store IIS configuration settings in XML file, improved reliability by means of application pools, and so on. We will also demonstrate how to create effective ASP.NET Web applications that can leverage the features of IIS 6.0. Along the way, we will also illustrate the changes in the security model of IIS 6.0 and how they affect your ASP.NET applications. In Part 1 of this article, we will look at the steps to follow to install IIS 6.0 and then understand how to host ASP.NET applications in IIS 6.0. We will also review the different isolation modes of IIS 6.0 and how they impact ASP.NET applications.
A new generation of Web applications puts a greater demand on performance and scalability attributes of Web servers. For example, the Web server is expected to increase the speed at which HTTP requests are processed, but still allowing more applications and sites to run on one server. This also means that very few servers are needed to host a site, allowing the existing hardware investments to sustain longer while being able to handle greater capacity. Another important aspect of the Web server is its reliability. IIS 6.0 has been designed from the ground up to allow us to create reliable applications. For example, in IIS 6.0, you can isolate each application or Web site to run in its own process space. By doing this, you can ensure that applications are isolated and problems in one site do not affect the rest of the applications on the same server.
IIS 6.0 Architecture
Before we take a look at IIS 6.0's architecture, let us take a moment to understand the IIS 5.0 architecture. In IIS 5.0, there was only one main process, represented by the executable inetinfo.exe, that was designed to function as the main Web server process, which could route requests to one or more out-of-process applications that are running within the dllhost.exe. With this architecture, Inetinfo.exe is the master process through which each request must traverse regardless of isolation mode. IIS 5.0 had three isolation modes: In-Process, Out-of-process, and Pooled. In the In-Process mode, all the applications run in the same process as that of the Web server (inetinfo.exe). The IIS 5.0 default mode is Pooled, in which the Web server (Inetinfo.exe) runs in its own process and all other applications will run in one single-pooled process (dllhost.exe). You can set high-priority applications to run as Isolated, which creates another instance of dllhost.exe. Even though this out-of-process isolation allows you to increase the fault-tolerance of your Web server, it is slow in terms of performance. The Pooled mode is the best performance/isolation tradeoff, but there is only one pool on a server and all pooled applications must use the same pool.
In this section, we will look at the architecture of IIS 6.0 to understand the compelling features provided by IIS 6.0 that contribute to the increase in scalability, reliability, and manageability.
IIS 6.0 has been totally re-designed with a new request processing architecture that has the benefits of high isolation without incurring the out-of-process cost, as well as much higher levels of reliability and scalability. You can split the main components of IIS 6.0 into the following two broad categories.
- HTTP.SYS—HTTP.SYS is a kernel-mode HTTP listener that listens for incoming requests and queues those requests up on the appropriate queue. Each request will be serviced by one application pool. An application pool in IIS 6.0 can contain one or more applications. Another important thing to note is that no third-party code can run in HTTP.SYS, improving the stability of the Web server.
- WAS (Web Administration Service)—WAS is a user-mode configuration and process manager. The Web Administration Service component performs the following two operations: Configuration and Process Management. Again, no third party is allowed here. When the Web server is first initialized, the WAS configures HTTP.SYS and the application pools. It is also responsible for monitoring and controlling the lifetime of the worker processes. To this end, the WAS also can perform activities such as health monitoring of processes, recycle worker processes automatically based on admin set criteria, start and stop worker processes, and so on.
- Application Pool—Application pools are used to manage a set of Web sites and applications. Each application pool corresponds to one request queue within HTTP.sys and the one or more Windows processes that process these requests. IIS 6.0 can support up to 2,000 application pools per server, and there can be multiple application pools operating at the same time. For example, a departmental server might have HR in one application pool and finance in another application pool. An Internet Service Provider (ISP) might have the Web sites and applications of one customer in one application pool, and the Web sites of another customer in a different application pool. Application pools are separated from other application pools by Windows Server 2003 process boundaries. Therefore, an application in one application pool is not affected by applications in other application pools, and an application request cannot be routed to another application pool while being serviced by the current application pool. Applications can easily be assigned to another application pool while the server is running.
- Worker Process—A worker process services requests for the Web sites and applications in an application pool. All Web application processing, including loading of ISAPI filters and extensions, as well as authentication and authorization, is done by a new WWW service DLL, which is loaded into one or more host worker processes. The worker process executable is named W3WP.EXE.
Benefits of the IIS 6.0 Request Processing Architecture
The IIS 6.0 request processing architecture explained in the previous section delivers very high levels of reliability without sacrificing performance. Especially,
- Increased reliability—IIS 6.0 worker process isolation mode prevents Web sites and applications from affecting each other or the server as a whole.
- Fewer server restarts—The user will likely never need to restart the server or shut down the entire WWW service, due to a failed application or common administration operations, such as upgrading content or components, or debugging Web applications.
- Increased application availability—IIS 6.0 supports auto restart of failed applications and periodic restart of misbehaving applications, or applications with faulty code.
- Increased scalability—IIS 6.0 supports scaling to ISP scenarios, where there may be hundreds to thousands of sites on a server. IIS 6.0 also supports Web gardens, where a set of equivalent worker processes on a server each receive a share of the requests that are normally served by a single worker process.
- Strong application platform support—IIS 6.0 supports the application as the unit of administration. This includes making the application the unit of "robustness" by enabling application isolation, and also enabling resource throttling and scaling based on the application.
In the following section, we will illustrate the procedures for installing IIS in your Windows 2003 Server.