"Framework" http run-time vs. Page execution model

Source: Internet
Author: User

HTTP Operating period

The HTTP runtime handles a Web request entered by a client application (such as a Web browser) , routes the request by processing the appropriate components of its application, and then generates a response to the client application that made the request back.

into the HTTP Web requests are first received by the IIS Web server, where it requests an extension based on the ASP. NET- registered processing to be routed to the ASP .

The HTTP runtime first creates an instance of the HttpContext object that contains the request information that is currently being processed, and then creates a context object that can be used by all other components involved in the processing logic. The HttpContext instance provides access to the Request object ( An instance of the HttpRequest class) and the Response object (an instance of the HttpResponse Class).

The HTTP runtime integrates a processing pipeline that consists of components called HTTP modules (HTTP Module) for performing request preprocessing actions (such as cache queries and authorizations) and post-processing actions (such as updating the tuning cache). These components implement the IHttpModule interface. In pipelines, each module handles different global application hierarchies and specific request events to execute its logic.

HTTP runtime based on the requested URL also selects an HTTP handler ( the component that implements the IHttpHandler interface) or the HTTP handler factory (implementing IHttpHandlerFactory interface components) to complete the actual process of introducing the request. The handler uses the HttpContext object to gather the request information and write out the results of the response.


Figure 1: Request handling process in an ASP. Net Web Application

a HTTP process of Request

when a After the HTTP request is fed into HttpRuntime , the HTTP request continues to be fed into a container called httpapplicationfactory . This window will give a HttpApplication instance to handle the incoming HTTP request, and then the HTTP request will go into several containers in turn:

HttpModule --> HttpHandler Factory --> HttpHandler

when the system's internal After the HttpHandler 's Processresquest method has been processed, the entire Http Request is processed and the client gets the corresponding result.

a complete HTTP requests are handled in the ASP. NET Framework 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 page the HTTP handler factory starts, which registers the HTTP runtime to process requests for all . aspx files. The page handler factory is responsible for creating an instance of the Page object, which is the HTTP handler that will eventually process the response resulting from the request .

first, the page handler factory tries to find the previously compiled page class within the. NET cache associated with the requested. aspx file. When a lookup fails, as in the case of the first request, the handler factory reads and parses the file and creates a parse tree. A parse tree is similar to a control tree, but does not contain controls, and the parse tree containsAn instance of an object called control builder. The control builder contains information about the controls that were collected during the parsing process. The parse tree is then transformed into code using the Language attribute in the page directive , in thelanguage associated with the pages. The page handler factory then calls the appropriate compiler to dynamically compile the classes that are obtained from the page, which also places the newly created class in the ASP . NET tuning cache, and associates the cache record with the file affinity. File Dependencies Monitor The changes made by the. aspx file and ensure that any changes automatically invalidate the cache record, and that the records will parse the modified file again on the next request.


Figure 2: How the page handles the request

Resources
The ASP. NET server control and component development
The ASP. NET in-depth analysis "

"Framework" http run-time vs. Page execution model

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.