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 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 hosted program, but our real ASP. NET Application runs on a Worker Process called aspnet_wp. It loads CLR during initialization, so it 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:
First, only one aspnet_wp process can be run on the same host at a 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.
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.
Finally, because 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 system code runs 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.
- Three pages in total:
- Previous Page
- 1
- 2
- 3
- Next Page