ASP. NET Framework-HTTP runtime and page execution model

Source: Internet
Author: User

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.

 


Figure
1: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.

 


Figure
2: How to process requests on a page

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.