Iis5, IIS6, iis7 Asp.net request processing process comparison)

Source: Internet
Author: User
Tags metabase

Source: http://blog.joycode.com/ghj/archive/2008/07/25/115200.aspx

 

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 articleArticleBy comparing IIS 5, IIS6, and iis7, we are familiar with ASP. net underlying mechanism and how the request is transmitted from the Web server to ASP. net runtime. By understanding the underlying mechanism, we can have a deeper understanding of Asp.net.

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 a Web server, IIS runs on a process named inetinfo.exe. inetinfo.exe is a native executive, not a hostedProgramAnd our real ASP. NET application is running on a worker process called aspnet_wp. the CLR will be loaded during the process initialization, so this is a managed 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 corresponds to an application domain, that is to say, each application runs in the same worker process. Application Isolation is based on application domain rather than process.

2. Second, Asp. net ISAPI is not only responsible for creating the aspnet_wp worker process, but also responsible for monitoring the process. If the performance of aspnet_wp is detected to a lower limit, Asp. net ISAPI is responsible for killing the process. When aspnet_wp is terminated, subsequent requests will cause ASP. net isapi to re-create a 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. Essentially, the communication between the Inetinfo process of IIS and the worker process is the communication between different processes of the same machine (local interprocess communications), which is considered for performance, they use Named Pipe-based communication mechanisms. Communication between ASP. net 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. However, the worker process is synchronized to ASP. net ISAPI to obtain some server-based variables.

 

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. in user mode, request listening and distribution are performed. 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 critical operating system data, Windows provides two processor access modes: user mode and kernel mode ). Generally, the user program runs in user mode, while the Operating SystemCodeRun in 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 then it checks which application pool the request-based application belongs to based on metabase in IIS. If the application 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 in user mode. The application pool and worker process mapping are maintained in IIS metabase. Based on such a ing, the was (Web administrative service) transmits requests that exist in an application pool queue to the corresponding Worker Process (if not, such a process is created ). When the worker process is initialized, ASP. net isapi and ASP. net isapi are loaded to load CLR. The final process is related to IIS 5. X is the same: Create an application domain for the application through the create method of appmanagerappdomainfactory; process the request through the processrequest of isapiruntime, and then enter the process to 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.

Author: Guo hongjun http://blog.joycode.com/ghj

 

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

Before iis7, Asp. net is added to IIS in the form of iis isapi extension. In fact, both ASP and PHP are configured in the same way. (PhP adopts two configuration methods in IIS, in addition to the iis isapi extension method and CGI method, the system administrator can select the PHP program execution method). Therefore, the client will first process the HTTP request to IIS through IIS, then, IIS handles HTML static Web Pages Based on the required content type. If not, it assigns them to their respective iis isapi extension based on the required content type; if the requested content type is ASP. net.. Net iis isapi extension, 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

IIS 7 is fully integrated. net, the processing order of the architecture is significantly different (for example), the main reason is ASP. net from the IIS plug-in (ISAPI extension) role, enter the IIS core, and can also use ASP. the net module is responsible for handling many types of IIS 7 Requirements. These ASP. the net module cannot only process ASP. net web applications, such as ASP, PHP, or static HTML web pages. net has become a part of IIS 7, so ASP, PHP, or static HTML web pages can also use forms authentication) or output cache and other ASP.. NET 2.0 (but the setting value of IIS 7 must be modified ). Because IIS 7 allows you to use ASP.. Net API development and add modules, so ASP. net web developers will be more likely to expand the functions of IIS 7 and website applications, and even can independently. net Program for managing IIS 7 (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.

 

 

References:

One of ASP. NET process models: IIS and ASP. NET ISAPI
Http://www.cnblogs.com/artech/archive/2007/09/09/887528.html

ASP. NET internals-IIS and the process model
Http://dotnetslackers.com/articles/iis/ASPNETInternalsIISAndTheProcessModel.aspx

Modular IIS 7 and. Net capability Integration
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/

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.