This article mainly introduces the content:
1.ASP. NET life cycle
2.Http Run time
3.Http Pipeline Technology
A) Inetinfo.exe
b) Asp.net_isapi.dll
c) aspnet_wp.exe
D) HttpHandler
e) HttpModule
4. Realizing the use of HttpHandler
5.ASP. NET life cycle
6. (IIS) Web server (Inetinfo.exe):
1. Only a handful of resource types that are requested by the client are processed directly by IIS, such as incoming requests for HTML pages, text files, JPEG, and GIF images
2. A request for an ASP. NET resource (*.ASPX,*.ASMX,*.ASHX) is passed to the ASP. NET ISAPI extension, which is a system component named
Aspnet_isapi.dll's Win32 Dll
7.aspnet_isapi.dll: Can handle multiple resource types, including Web services and HTTP handler calls
8.ASP. NET worker process (aspnet_wp.exe):
1. The call is made by Aspnet_isapi.dll
2.aspnet_wp.exe is responsible for controlling the execution of the request and can terminate the request
9.aspnet_isapi.dll
Register the mapping table with this command to associate *.aspx with Aspnet_isapi.dll.
(Note: You can add your own mappings, as will *.) Refactor associated with Aspnet_isapi.dll, this time the request suffix named refactor file and request *.aspx)
10.ISAPI relationship to the worker process
Communication between 1.ISAPI and worker processes is done using a set of named pipes
2. Named pipes are a Win32 mechanism for cross-process boundary transport mechanisms, and how Named Pipes work
Similar to pipelines: passing data at one end and outputting the same data at the other end. Establish pipelines to connect
Local process, you can also connect to a process running on a remote computer, and for local interprocess communication, the pipeline is
The most effective and flexible tool in Windows.
3.ISAPI uses an asynchronous named pipe to forward requests to the worker process and obtain the appropriate
4. The worker process uses the synchronization pipeline when it needs to query information about the IIS environment (that is, server variables)
The 5.ISAPI module creates a fixed number of named pipes and uses overlapping operations to pass through the small thread pool
Handles the connection at the same time. After the data exchange operation through the pipeline finishes, the routine
The client is disconnected and the pipeline instance is reused for the new client service. The thread pool and overlapping operations are all
You can ensure that the performance of the ASP. NET ISAPI reaches a satisfactory level.
However, the ASP. NET ISAPI extension will never process HTTP requests
11.ASP. NET's processing logic:
1. When the request arrives, IIS checks the resource type and calls the ASP. If the default
Process model, ASPNET_ISAPI queues the request and assigns the request to the worker process. All
Request data is sent via asynchronous I/O
2. After receiving the request, ASP. NET-worker process notifies the ASP., it will service the request (establish the pipeline)
3. Execute the request in the context of the worker process. Sometimes, a worker process may need to callback the ISAPI to complete the request, which is
It is necessary to enumerate the server variables. In this case, the worker process will use the synchronization pipeline because it can maintain
The logical order of request processing.
4. Upon completion, the response is sent to the ASPNET_ISAPI that opened the asynchronous pipeline. If Aspnet_isapi detects
The worker process has been canceled, it will automatically terminate the request and release all related IIS resources
12.ASP. NET run-time environment
1. executable file that forms the ASP. NET Runtime Environment
The 2.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 3.aspnet_state.exe is more important for Web applications because he is used to manage session state
13.Http Pipe
1. In an ASP. NET application, the system uses a set of related classes to handle client requests in a certain order (Requset),
Asp. NET application can be called the HTTP processing pipeline
The 2.HttpModule and HttpHandler are the two processing steps on this processing pipeline.
For the gray part:
14. Describe the role of each class
1.HttpWorkerRequest abstract class defines the basic method for ASP. NET page processing request
2.HttpRuntime provides a set of services for processing applications
3.HttpContext holds all relevant contextual information for processing a request
4.HttpApplicationFactory applications that provide related catalogs
5.HttpApplicaiton defines common methods, properties, and events for all ASP.
The application base class defined in the Global.asax file by the user
6.HttpModules events before and after processing requests
7.HandlerFactories provides handlers in the application
8.HttpHandlers processing requests and responses
15.HttpHandler
1.HttpHandler processing requests (request) information and sending responses (Response)
2.HttpHandler implements functionality similar to ISAPI extention
The 3.system.web.ui.page class also implements the HttpHandler interface
4. You can execute our custom handler via HttpHandler intercept request
16.HttpHandler Example
1. Create a new Refactorhandler class
public class Refactorhandler:ihttphandler {public void ProcessRequest (HttpContext context) { HttpResponse response = context. Response; HttpRequest request = context. Request; Gets the file requested by the user string filePath = Request. FilePath; if (Filepath.endswith ("Refactor")) { response. Write ("
2. Modify the Web. config
Under the <system.web> node, add:
3. Testing
ASP. NET life cycle and HTTP pipeline technology