"Go" Different versions of IIS under the ASP. NET Request Processing Process Difference

Source: Internet
Author: User
Tags metabase



Original address: http://www.cnblogs.com/fsjohnhuang/articles/2332074.html



Asp. NET is a very powerful platform for building Web applications, providing great flexibility and ability to use it to build all types of Web applications.



The vast majority of people are only familiar with high-level frameworks such as: WebForms and webservices-these are at the highest level in the ASP.
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, only one aspnet_wp process can run at the same time on the same host, and each virtual directory-based ASP. NET application corresponds to a application Domain, which means that each application is running in the same Worke In R Process, the isolation between application is based on application Domain, not process-based.
    2. Second, the ASP is not only responsible for creating the aspnet_wp Worker process, but also for monitoring the process, and if the aspnet_wp performance is detected to a lower limit, the ASP. NET ISAPI will be responsible for ending 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 performance considerations, They use a communication mechanism based on named pipe. The communication between the ASP. NET ISAPI and worker process is implemented through a set of pipes between them. Also in performance, the ASP. NET ISAPI asynchronously passes the request to Worker process and obtains Response, but the Worker process is synchronized to the ASP. Get some Server-based variables.


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 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 the application Pool that the application based on the request belongs to, based on the Metabase in IIS, 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) passes the request that exists in a application Pool queue to the corresponding worker process (if not, based on such a mapping). Create a process like this). 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 creation method; isapiruntime ProcessRequest 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. When the client browser starts the HTTP request for a Web server resource, the. SYS intercepts the request.
    2. HTTP. SYS contacts is to obtain information from the configuration store.
    3. was requested configuration information from the configuration Store center. ApplicationHost.config.
    4. The WWW service receives configuration information, configuration information such as 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 the W3WP.exe process is done?? The managed pipeline pattern for an application pool for IIS 7 is divided into two types: classic and integrated. These two modes of processing strategies are not interlinked.



This article Guo Hongjun HTTP://BLOG.JOYCODE.COM/GHJ



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 are configured in the same way (PHP is configured in IIS in two ways, except for IIS ISAPI extension , including CGI, the System Manager can choose the way the PHP program executes), so the client's HTTP request to IIS is processed by IIS first, and then IIS is handled by IIS according to the required content type, if it is an HTML static Web page, if it is not, as requested The content type, assigned to the respective IIS ISAPI extension, and if the requested content type is ASP., is assigned to the IIS ISAPI extension, which is the aspnet_isapi.dll, that handles ASP. This is the architecture.



The Classic mode of managed pipeline mode for IIS 7 application pools works as well. 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 integration mode for IIS 7 application pools



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 themselves, such as programmatically 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.


References :



One of the ASP. NET Process Model: IIS and ASP. NET ISAPI 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 and. NET Competency Integration



Introduction to IIS 7.0 Architecture http://learn.iis.net/page.aspx/101/introduction-to-iis7-architecture/



"Go" Different versions of IIS under the ASP. NET Request Processing Process Difference


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.