asp.net request processing process analysis under each version of IIS 1th/3 page _win server

Source: Internet
Author: User
Tags metabase


The vast majority of people are familiar with high-level frameworks such as WebForms and WebServices, which are at the highest level in the ASP.net hierarchy.

This article is compiled from a variety of Microsoft-exposed documents, by comparing the IIS5, IIS6, IIS7 of the three generations of IIS to the request process, let us familiarize ourselves with ASP. NET and to understand how requests are routed from the Web server to the ASP.net runtime. By understanding the underlying mechanism, we can have a deeper understanding of asp.net.

The asp.net request processing process for IIS 5

Explanation of the diagram:

One notable feature of IIS 5.x is the separation of Web Server and real asp.net application. IIS running as Web Server runs on a process named InetInfo.exe, InetInfo.exe is a native Executive, not a hosted program, and our real asp.net application is run on top of a Worker process called aspnet_wp, which loads the CLR when the process initializes, so this is a managed environment.

ISAPI: An application that can handle various suffix names. The 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 one aspnet_wp process at a time, and each ASP.net application based on the virtual directory corresponds to a application Domain, which means that each application runs in the same Worke In R process, the isolation between application is based on application Domain, not on process.
    2. Second, the ASP.net ISAPI is responsible for creating the aspnet_wp Worker process and monitoring the process, and if the performance of aspnet_wp is detected to be lowered to a set lower limit, ASP.net ISAPI will be responsible for ending The process. After the aspnet_wp is finished, subsequent Request will cause the asp.net ISAPI to recreate the new aspnet_wp Worker Process.
    3. Finally, since IIS and application are running in their respective processes, communication between them must be based on a specific communication mechanism. Essentially, the communication between the InetInfo process of IIS and the Worker process is communication between different processes of the same machine (local interprocess communications), which is considered in performance, They adopted a communication mechanism based on named pipe. Communication between the ASP.net ISAPI and the worker process is implemented through a set of pipe between them. Also in the performance, ASP.net ISAPI passes the request to the Worker process and obtains the Response asynchronously, but the worker process is synchronized to the ASP.net ISAPI Get some server-based variables.

IIS6 's asp.net request processing process

Explanation of the diagram:

IIS 5.x monitors 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, which, in IIS 6, is ported into kernel mode, all of which is in the charge of a new component: HTTP.sys.

Note: To avoid user applications accessing or modifying critical operating system data, Windows provides two types of processor access modes: User mode and kernel mode (Kernel mode). Generally, the user program runs under User mode, while the operating system code runs under kernel mode. The code in Kernel mode allows access to all system memory and all CPU instructions.

Under User mode, HTTP.sys receives an ASPX HTTP request, and then it views the application Pool that is based on the request's application according to the Metabase in IIS, if the Application pool does not exist, it is created. Otherwise, the request will be sent directly to the queue corresponding to application Pool.

Each application Pool corresponds to a worker Process:w3wp.exe, who is undoubtedly running under User mode. The mapping of application Pool and worker process is maintained in IIS Metabase. Was (Web administrative service) passes a request that exists in a application Pool queue to the corresponding worker process according to such a mapping (if not, To create such a process). When the worker process is initialized, load the asp.net isapi,asp.net ISAPI and then load the CLR. The final process is the same as the IIS 5.x: Create a application Domain for application through the Appmanagerappdomainfactory creation method; ProcessRequest processes the request, which then enters the process into the ASP.net Http Runtime Pipeline.

Current 1/3 page 123 Next read the full text
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.