Reprinted:
HTTPRuntime
HTTPProcess client applications at runtimeProgram(For exampleWebBrowser)WebRequests are routed by appropriate components of the application, and then the client application that responds to the concurrent request is generated.
EnterHTTP webThe request is initiatedIIS WebThe server receives the request based onASP. NETThe registered processing extension is transferredASP. NET ISAPI.
HTTPCreateHttpcontextAn instance of the object that contains the request information being processed, and then creates a context object that can be used by all other components involved in the processing logic.HttpcontextThe instance provides (HttprequestClass instance) and response object (Httpresponse.
HTTPRuntime integration is calledHTTPModule (HTTP ModuleThe processing pipeline composed of components, used to execute Request preprocessing actions (such as cache query and authorization) and post-processing actions (such as updating and adjusting cache ). Implementation of these componentsIhttpmoduleInterface. In the pipeline, each module processes different global application layers and specific request events to execute its logic.
HTTPRequest-basedURLSelectHTTPHandler (ImplementationIhttphandlerInterface components) orHTTPProcessing Factory (ImplementationIhttphandlerfactoryInterface) to complete the actual processing process of the request. Processing ProgramHttpcontextObject To collect request information and write the response results.
Figure1:ASP. NET webRequest Processing in applications
OneHTTPRequest Processing Process
WhenHTTPRequest sentHttpruntimeLater, thisHTTPThe request will continue to be sent toHttpapplicationfactory. This window will provideHttpapplicationInstance to process passed inHTTPRequest, and thenHTTPRequests are sequentially routed to the following containers:
Httpmodule--> Httphandler Factory--> Httphandler
WhenHttphandlerOfProcessresquestAfter the processing is completed, the entireHTTP RequestThe processing is complete, and the client gets the corresponding result.
A completeHTTPRequest inASP. NET FrameworkThe process is as follows:
Httprequest--> Inetinfo.exe--> Aspnet_isapi.dll--> HTTP Pipeline--> Aspnet_wp.exe--> Httpruntime--> Httpapplication Factory--> Httpapplication--> Httpmodule--> Httphandler Factory--> Httphandler--> Httphandler. processrequest ()
Page execution model
Page execution model by PAGEHTTPThe handler factory starts and it registersHTTPRun all. AspxFile Processing request. The page handler factory is responsible for creatingPageInstance of the object, which will eventually process the response results generated by the requestHTTPProcessing Program.
First, the page handler factory tries. AspxFile-related. NetSearch for previously compiled page classes in the cache. When the search fails, like the first request, the handler factory will read and parse the file and create a resolution tree (Parse Tree). The resolution tree is similar to the Control tree, but does not contain controls (Control Builder. The control builder contains the control information collected during the parsing process. ThenPageIn the commandLanguage attributeTo convert the parsing treeCode. Then, the page handler factory calls the appropriate Compilation Program to dynamically compile fromPageThe page handler factory also places the newly created classASP. NETAdjust the cache and associate the cache records with the file relevance. File relevance monitoring. AspxFile changes, and ensure that any changes will automatically invalidate the cache records. In the next request, these records will be resolved again.
Figure2: How to process requests on a page