Comparison of Asp.net request processing processes of iis5, IIS6, and iis7

Source: Internet
Author: User
ASP. NET is a very powerful platform for building Web applications. It provides great flexibility and capabilities that can be used to build all types of Web applications.
Most people are only familiar with high-level frameworks such as webforms and WebServices-all of which are at the top of the ASP. NET hierarchy.

This document is collected from various documents published by Microsoft. By comparing the request processing processes of IIS 5, IIS 6, and IIS 7, we are familiar with this article.
The underlying mechanism of ASP. NET and some knowledge about how requests are transmitted from the Web server to ASP. NET runtime. By understanding the underlying mechanism, we can
Asp.net has a deeper understanding.

Asp.net request processing in IIS 5

Description of the graph:

A notable feature of IIS 5.x is the separation of Web server and real ASP. NET application. As Web
The IIS of the server runs in the process named inetinfo.exe. inetinfo.exe is a native
Executive is not a managed program, but our real ASP. NET application runs in a program called aspnet_wp.
In a worker process, CLR is loaded during initialization, so this is a hosted environment.

ISAPI: an application that can process various extensions. ISAPI is short for the following words: Internet server application programe interface, Internet server application interface.

Features of IIS 5 mode:

1. First, only one aspnet_wp process can be run on the same host at the same time, and each ASP. NET application based on the virtual directory
Corresponds to an application domain, that is, each application runs in the same Worker Process
Application Isolation is based on application domain, rather than process.

2. ASP. net isapi is not only responsible for creating the aspnet_wp worker process, but also for monitoring the process.
The performance of aspnet_wp is reduced to the lower limit. ASP. net isapi is responsible for terminating the process. When aspnet_wp
After the request is completed, ASP. net isapi will re-create the new aspnet_wp worker process.

3. Finally, since IIS and application are running in their respective processes, the communication between them must adopt a specific communication mechanism. In essence
The communication between inetinfo process and worker process is the communication between different processes of the same machine (local interprocess
Communication Mechanisms Based on named pipe are adopted between them for performance consideration. ASP. NET
Communication between ISAPI and worker process is implemented through a set of pipe between them. ASP. NET
ISAPI uploads the request to the worker process asynchronously and obtains the response, but the Worker Process
The server-based variables are obtained from ASP. net isapi in synchronous mode.

IIS6 Asp.net request processing process

Description of the graph:

IIS 5.x listens to requests through inetinfo.exe and distributes requests to work
Process. In other words, in IIS 5.x, request listening and distribution are performed in user mode, in IIS
6, this kind of work is transplanted to the kernel mode. All of this is done through a new component: http. sys.

Note: To prevent users' applications from accessing or modifying key operating system data, Windows provides two processor access modes: User Mode
Mode) and kernel mode ). Generally, the user program runs in user mode, while the operating system code runs in the kernel
Mode. The kernel mode code allows access to all system memory and all CPU commands.

In user mode, HTTP. sys receives an HTTP request based on aspx, and
Check which application pool the request-based application belongs to. If the application
If the pool does not exist, it is created. Otherwise, the request is directly sent to the queue of the corresponding application pool.

Each application pool corresponds to a worker process: w3wp.exe, which is undoubtedly running on the user
. Protecting application pool and worker in IIS metabase
Process mapping. Was (Web administrative
Service) according to such a mapping, the request that exists in an application pool queue is passed to the corresponding worker
Process (if not, create such a process ). When the worker process is initialized, ASP. net isapi, ASP. NET
ISAPI then loads CLR. The final process is the same as that of IIS 5.x: The create method of appmanagerappdomainfactory is
Application creates an application domain.
Processrequest processes the request and then enters ASP. net http runtime pipeline.

Asp.net request processing in IIS 7

The iis7 site starts and processes the request as follows:

Steps 1 to 6 are to process application startup. After the application is started, you do not need to perform this step again.

The eight steps are as follows:

1. When the client browser initiates an HTTP request for a Web server resource, HTTP. sys intercepts the request.
2. http. sys contacts was to obtain information from the configuration store.

3. Was requests configuration information from the configuration storage center. Applicationhost. config.
4. the WWW Service receives the configuration information, which is similar to the application pool configuration information and site configuration information.
5. Use the configuration information of the WWW Service 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 the w3wp.exe process is processed ?? The managed pipeline mode of the application pool of IIS 7 is divided into two types: Classic and integration. In these two modes, the processing policies are different.

 

Architecture of managed pipelines in IIS 6 and iis7 in Classic Mode

Before iis7, ASP. NET was added to IIS in the form of iis isapi extension, including ASP and
PHP is also configured in the same way (PhP adopts two configuration methods in IIS, in addition to the iis isapi extension method, it also includes CGI
The system administrator can select the PHP program execution method). Therefore, the HTTP request sent from the client to IIS is first processed by IIS, and then the IIS
According to the required content type, IIS handles HTML static webpages by itself. If not, it assigns them to their respective IIS isapis Based on the required content type.
Extension; if the required content type is ASP. NET, it is assigned to the iis isapi extension responsible for processing ASP. NET, that is
Aspnet_isapi.dll. This is the architecture.

The classic mode of the managed pipeline mode of the IIS 7 Application pool also works. This mode is compatible with IIS 6 to reduce the upgrade cost.

The execution architecture of IIS6 and the execution architecture of the iis7 application pool configured in Classic Mode

Managed pipeline mode integration mode of IIS 7 Application pool

After IIS 7 is fully integrated with. net, the processing sequence of the architecture is significantly different (for example,). The main reason is that ASP. NET
The role of the IIS plug-in (ISAPI extension) enters the IIS core, and the ASP. NET module is also responsible for processing IIS 7
. These ASP. NET modules can not only process ASP. NET web programs, but also process other such ASP programs, PHP programs, or static html
Web pages, because ASP. NET has become part of IIS 7, ASP programs, PHP programs, or static html
Web pages and other types of requirements can also use ASP. NET, such as Forms authentication or output cache.
2.0 feature (but must modify the value of IIS 7 ). Because IIS 7 allows you to develop and add modules using ASP. NET APIs, ASP. NET
Web developers can easily expand the functions of IIS 7 and website applications, and even write programs for managing IIS 7 in. Net (for example, program-controlled IIS 7 ).
To build a website or virtual directory ).

Execution architecture diagram of IIS 7 (Architecture in managed channel mode)

Summary

Iis5 to IIS6 Improvements mainly include improvements to HTTP. sys.

The improvements from IIS6 to iis7 mainly involve improvements to isapis.

Original article: http://www.cnblogs.com/Memory/archive/2009/10/16/1584696.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.