Iis5 IIS6 iis7 Asp.net request processing process comparison

Source: Internet
Author: User
Tags metabase

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 the underlying server of ASP. NET.
And understand how requests are 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 Web
The iisws of serverare running 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 process based on the virtual directory
The application corresponds to an application domain, that is, each application runs on the same worker.
In process, application isolation is based on application domain rather than process.

 

 
2. ASP. net isapi is not only responsible for creating aspnet_wp worker
Process, and is responsible for monitoring the process, if the performance of aspnet_wp is detected to a set lower limit, ASP. NET
ISAPI is responsible for killing the process. When aspnet_wp is terminated, subsequent requests will cause ASP. NET
ISAPI re-creates a new aspnet_wp worker process.

3. Finally, due to IIS and
Applications run in their respective processes. Communication between them must adopt a specific communication mechanism. Essentially, the Inetinfo process and worker of IIS
Communication between processes is the communication between different processes on 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
The ISAPI uploads the request to the worker process asynchronously and obtains the response, but the worker
Process obtains server-based variables from ASP. net isapi in synchronous mode.

IIS6 Asp.net request processing process

Description of the graph:

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

Note: To prevent user applications from accessing or modifying the number of key operating systems
Windows provides two processor access modes: user mode and kernel mode ). Generally, the user program runs on the user
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 ASPX-based HTTP
Request, and then it will check which application the request-based application belongs to based on metabase in IIS
Pool. If the application pool does not exist, it is created. Otherwise, the request is directly sent to the corresponding application pool
In the queue.

Each application pool corresponds to a worker
Process: w3wp.exe, which is undoubtedly running in user mode. Protects application in IIS metabase
Mapping of pool and worker process. 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: Through appmanagerappdomainfactory
The create method creates an application domain for the application.
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.

Http://blog.joycode.com/ghj in this article

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, besides the iis isapi extension method, the CGI method is also included, and the system administrator
Can select the PHP program execution method), so the client
The HTTP request is first processed through IIS, and then IIS handles the request based on the requested content type. If it is an HTML static webpage, IIS will handle it by itself. If it is not, it will be assigned to each
Self-defined iis isapi extension. If the required content type is ASP. NET, it is assigned to the iis isapi responsible for processing ASP. NET.
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

While
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 is from the IIS plug-in (ISAPI
Extension), enter 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 Webpage Programs, but also process other HTML webpages, such as ASP, PHP, or static.
Various functions of ASP. NET have been
As part of IIS 7, ASP, PHP, static HTML, and other types of requirements can also use forms authentication (Forms ).
ASP. NET 2.0 features, such as authentication or output cache (output cache), must be modified
). Because IIS 7 allows you to develop and add modules using ASP. NET APIs, ASP. NET web page developers can easily expand IIS 7
And the functions of website applications, or even write programs for managing IIS 7 in. Net (for example, program-controlled IIS 7 to build websites or virtual directories ).

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. ,

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.