This article collected data from various Microsoft public documents, by comparing IIS5, IIS6, IIS7 three generations of IIS to the request processing process, let us familiar with ASP. NET and an understanding of how requests are routed from the Web server to the ASP. Understanding the underlying mechanism allows us to have a deeper understanding of ASP.
The ASP. NET request processing process for IIS 5
Explanation of the diagram:
One notable feature of IIS 5.x is the separation of the Web Server and the real ASP. NET application. IIS as a Web Server runs on a process called InetInfo.exe, InetInfo.exe is a native Executive, not a managed program, and our real ASP. NET Application is run on a Worker process called aspnet_wp, which loads the CLR when the process is initialized, so this is a managed environment.
ISAPI: Refers to an application that can handle various suffix names. ISAPI is a shorthand for the following words: Internet server application programe Interface, Internet Servers application interface.
Features of IIS 5 mode:
1, first, the same host can only run a aspnet_wp process at the same time, each virtual directory-based ASP. Application corresponds to a application Domain, which means that each application is running in the same Wor In ker process, the isolation between application is based on application Domain rather than process-based.
2, second, the ASP is not only responsible for creating aspnet_wp Worker process, but also responsible for monitoring the process, if the detection of aspnet_wp performance down to a certain set lower limit, ASP. NET ISAPI will be responsible for the knot Bundle off the process. When ASPNET_WP is finished, subsequent Request causes the ASP. NET ISAPI to recreate the new aspnet_wp Worker Process.
3. Finally, because IIS and application run in their respective processes, communication between them must be based on a specific communication mechanism. Essentially, the communication between the InetInfo process and the Worker process that IIS is in is communication between different processes of the same machine (local interprocess communications), in the performance consideration, between them using a The communication mechanism of Named pipe. The communication between the ASP. NET ISAPI and Worker Process is implemented through a set of pipes between them. Also in performance, theASP. NET ISAPI asynchronously passes the Request to the worker process and obtains the Response, but the Worker process is synchronized to the ASP. NET ISAPI get some based on
The variables for the Server.
IIS6 ASP. NET Request Processing process
Explanation of the diagram:
IIS 5.x listens to the request via InetInfo.exe and distributes the request to the work Process. In other words, the listener and distribution of the Request in IIS 5.x is done in User Mode, and in IIS 6, this work is ported to Kernel Mode, all of which are responsible through a new component-http.sys.
Note: To avoid user applications accessing or modifying critical operating system data, Windows provides two processor access modes: User mode and kernel mode (Kernel modes). In general, the user program runs under User mode, while the operating system code runs under Kernel mode. Kernel Mode's code allows access to all system memory and all CPU instructions.
Under User mode, HTTP. SYS receives an ASPX-based request, and then it looks at which application based on the request's application according to the Metabase in IIS Poo L, if the application Pool does not exist, it is created. Otherwise, the request is sent directly to the queue corresponding to the application Pool.
Each application Pool corresponds to a Worker process-w3wp.exe, and there is no doubt that he is running under User mode. The mapping of application Pool and Worker Process are maintained in IIS Metabase. The WAS (Web administrative Service), based on such a mapping, passes the request that exists in a application Pool Queue to the corresponding Worker Process (if not, creates such a Process). When the Worker Process is initialized, the ASP. Isapi,asp.net ISAPI loads the CLR. The final process is the same as IIS 5.x: Create a application Domain for application through the Appmanagerappdomainfactory's Create method; Isapiruntime Proc Essrequest processes the Request, which then enters the ASP. NET Http Runtime Pipeline.
The ASP. NET request processing process for IIS 7
The steps for the IIS7 site to start and process requests such as:
Step 1 to 6, is the processing application start, after the start, there is no need to go this step again.
The 8 steps were as follows:
1. http. sys intercepts this request when the client browser begins to request a resource for a Web server.
2. http. SYS contacted was to obtain configuration information.
3. Was requested configuration information from the Configuration Store Center (applicationhost.config).
4, the WWW service receives configuration information, configuration information refers to similar application pool configuration information, site configuration information and so on.
5. The WWW service uses configuration information to configure the HTTP. SYS processing policy.
6, was starts a worker process for the application pool to which the request was made.
7. The worker process processes the request and returns a response to HTTP. sys.
8, the client receives the processing result information.
What if it is handled in the W3WP.exe process? The managed pipeline pattern for an application pool for IIS 7 is divided into two types: classic and integrated. The processing strategies are different in both modes.
Schema of the managed pipeline for IIS 6 and IIS7 Classic mode
Prior to IIS7, the ASP was implemented in IIS ISAPI extension with IIS, in fact both ASP and PHP were configured in the same way (PHP is configured in IIS in two ways, except for IIS ISAPI extension Way, but also includes the way of CGI, the System Manager can choose the way the PHP program executes, so the client's HTTP request to IIS will be processed by IIS first, and then IIS, depending on the required content type, if the HTML static Web page is handled by IIS itself, if not, according to the Assigned to the respective IIS ISAPI extension, and if the required content type is ASP, it is assigned to the IIS ISAPI extension, which is the aspnet_isapi.dll that handles ASP. This is the architecture.
This is how the managed pipeline mode "classic" mode of the IIS 7 application pool works. This mode is compatible with IIS 6 to reduce the cost of the upgrade.
IIS6 execution architecture diagram, and IIS7 application pool configured for Classic mode execution architecture diagram
Managed pipeline mode for IIS 7 application Pools-Integrated mode
After IIS 7 fully integrates. NET, the processing order of the schemas is very different (for example), and the main reason is that ASP. Extension into the IIS core from the role of the IIS Plug-in (ISAPI), and can also take care of IIS 7 with the ASP. Many types of requirements. These ASP. asp programs, PHP programs, or static HTML are not the only things that can work with ASP programs, PHP programs, or static HTML Web pages, but also because many of the features of ASP. NET are already part of IIS 7. The requirements for types such as Web pages, you can also use ASP. NET 2.0 such as Forms authentication (forms authentication) or output cache, (but you need to modify the settings for IIS 7). Also because IIS 7 allows developers to develop and join modules on their own with the ASP. NET Web page developers, it is easier for ASP to extend the functionality of IIS 7 and Web site applications, and even to write programs that manage IIS 7 on their own, such as the program that controls IIS 7 to build Web sites or virtual directory).
Execution architecture diagram for IIS 7 (architecture in integrated managed channel mode)
Summary
IIS5 to IIS6 improvements, mainly HTTP. sys.
IIS6 to IIS7 improvements, mainly ISAPI improvements.
Resources:
One of the ASP. NET Process Model: IIS and ASP.
Http://www.cnblogs.com/artech/archive/2007/09/09/887528.html
ASP. Internals–iis and the Process Model
Http://dotnetslackers.com/articles/iis/ASPNETInternalsIISAndTheProcessModel.aspx
Modular IIS 7 integration with. NET Capabilities
Http://www.microsoft.com/taiwan/technet/columns/profwin/33-iis7-componentization-integration.mspx
Introduction to IIS 7.0 Architecture
Http://learn.iis.net/page.aspx/101/introduction-to-iis7-architecture/
IIS internal operating mechanism