When the user enters a URL address in the browser, the browser sends a request to the server. This is the first time that the server is responsible for processing the request IIS. IIS then requests distribution to different ISAPI processing based on the requested URL extension.
The process is as follows:
1. IIS = Aspnet_isapi Phase
ISAPI is an underlying WIN32 API that developers can use to drill down into IIS, allowing IIS to support a variety of other handlers. An ISAPI is a bridge interface that is typically used to connect between high-level tools and IIS. For example, Apache and Tomcat under Windows are built on top of the ISAPI. ISAPI is the first IIS entry point in a custom Web request processing.
In the preceding steps, IIS handles requests for HTML pages, txt files, jpeg, and GIF images, and when the request is found to be an ASP (such as *.ASPX,*.ASMX,*.ASHX), the request is passed to the ASP. ISAPI Extension Aspnet_isapi.dll.
Aspnet_isapi.dll can handle a variety of resource types, including Web services and HTTP handler invocations.
such as the handler mappings in IIS7:
The mapping above means that the path to the. aspx extension is passed to the Aspnet_isapi.dll handler for processing.
2. Aspnet_isapi + = Auxiliary process
The worker process in (IIS5 is ASPNET_WP.EXE;IIS6 is w3wp.exe).
ASPNET_ISAPI communication with the worker process:
- Communication between ASPNET_ISAPI and worker processes is done using a set of named Pipes, which is a Win32 mechanism for cross-process boundary transport mechanisms and how named pipes work. Similar to piping: passing data at one end and outputting the same data at the other end. Establishing a pipeline can either connect to a local process or a process running on a remote computer, and for local interprocess communication, the pipeline is the most efficient and flexible tool in Windows.
- ISAPI uses an asynchronous named pipe to forward requests to the worker process and get a response.
- The worker process uses the synchronization pipeline when it needs to query information about the IIS environment (that is, server variables).
- The ISAPI module creates a fixed number of named pipes and uses overlapping operations to process connections at the same time through a small thread pool. When the data exchange operation through the pipeline finishes, the routine is completed, the client is disconnected, and the pipeline instance is reused for the new client service. The thread pool and overlapping operations ensure that the performance of the ASP. NET ISAPI reaches a satisfactory level. ASPNET_ISAPI will never process HTTP requests.
The processing logic for IIS and ASPNET_ISAPI:
- When the request arrives, IIS checks the resource type and calls the Aspnet_isapi extension. If the default process model is enabled. ASPNET_ISAPI will queue the request. And the request is assigned to the worker process, and all the request data is sent through asynchronous I/O.
- When the request is received, ASP. The net worker process notifies aspnet_isapi that it will serve the request (establishing a pipeline).
- Executes the request in the context of the worker process. Sometimes, a worker process may need to call back Aspnet_isapi to complete the request, that is, to enumerate the server variables. In this case, the worker process will use the synchronization pipeline, as this will maintain the logical order of request processing.
- Upon completion, the response is sent to the ASPNET_ISAPI that opened the asynchronous pipeline. If ASPNET_ISAPI detects that the worker process has been canceled, it automatically terminates the request and frees all related IIS resources.
3. ASP. NET Runtime Environment:
The executable file that makes up the ASP. Runtime environment is as follows:
| Name |
Type |
Account |
| Aspnet_isapi.dll |
Win32 DLL |
LOCAL SYSTEM |
| aspnet_wp.exe |
Win32 EXE |
ASPNET |
| Aspnet_filter.dll |
Win32 DLL |
LOCAL SYSTEM |
| Aspnet_state.exe |
Win32 EXE |
ASPNET |
The Aspnet_filter.dll component is a small WIN32 ISAPI filter used to back up the non-cookie session state of an ASP.
The role of Aspnet_state.ext is more important for Web applications because it is used to manage session state.
Well, so far, IIS has forwarded the request to the worker process, which is actually the start of the ASP, and what we usually call ASP. NET development starts here.