Process description of the request processing response for an ASP.

Source: Internet
Author: User

Overview

This blog post runs from IIS to the ASP. NET page, the whole process does a simple description, if there is a wrong place, hope to point out.

the process by which IIS processes requests

When we access a Web page on an IIS server through a browser (socket client), the HTTP. SYS (dispatcher) component of IIS is handed over to the corresponding application pool (with the appropriate registration information on IIS), as appropriate, when the request arrives on the IIS server. After the corresponding application pool receives the request, it will be handed over to the corresponding worker process, the worker process receives the request, according to the request file suffix name, judge, if this file IIS can process, then directly processing, if cannot handle, from its registered plug-in configuration file to find the plug-in that can process the request ( Asp.net_isapi.dll, or PHP, and so on), and give it to the plug-in (proxy), and then, the plug-in to the actual processing program to the request.

Browser

From a program point of view, the browser is a socket client, and IIS is a socket server, so as to achieve the function of communication. For the above, we can use Telnet (socket client, win comes with the installation program, need to install itself) to verify, cmd input telnet 127.0.0.1 80, you can connect to the server, and then make a request, you will receive a corresponding response,

Asp.net_isapi.dll plug-in

IIS plug-in mechanism, so that IIS can serve in any language of the Web site, as long as it registers the appropriate plug-ins on IIS, then IIS can handle such a file request, such as you want to do PHP services through IIS, as long as the registration of PHP plug-ins can be, this idea is very bad, The scalability of IIS is greatly improved, of course, this plug-in is not a process of processing the request, but a proxy, through this proxy (written in the IIS configuration file content) can let IIS know that they can handle such files, and through this proxy, This request can be handed over to the real process and, of course, the returned result is returned through this.

We can view the file that it can process on the IIS server and view the handler mappings. If you are installing the VS, post-install IIS then, at this point, if you want your IIS to be able to process the corresponding file of ASP., we need to manually register Asp.net_isapi.dll in IIS, Operation: cmd-" directory to the. NET Framework directory (with Aspnet_regiis.exe program) installed in a specific version of this machine-run aspnet_regiis.exe-i

HTTP pipeline mechanism for the. NET Framework

Asp.net_ispai.dall accepts the request, gives it to the. NET Framework, and then begins the pipeline mechanism for HTTP.

The. NET Framework receives the request, instantiates the HttpRuntime object, calls the ProcessRequest method, and then instantiates the Application object through Httpapplicationfacotry. The instantiation process continues to instantiate the session HttpContext, HttpRequest, HttpResponse, module, and so on, and then finally instantiates an instance of the IHttpHandler interface.

If you notice, Our ASP. NET page is an implementation of the IHttpHandler interface, the ASP. NET page inherits the page class, and the page class inherits the IHttpHandler interface so that our ASP. NET page can access the object instantiated above. In addition, the Golbal file inherits the HttpApplication file, so that we can register the event in the HTTP pipeline by writing the method in the Golbal.

the life cycle of an ASP page

Instantiate the IHttpHandler interface instance, the actual instantiation of the ASP. NET page, and in the process of instantiating the ASP. The main events, initialization, loading, control events, saving state, rendering, unloading. Here we need to know that the execution of the control events on the page is, before pre-rendering, after load, of course, the first time, there will be no control event triggered, in the initialization phase, the creation of the tree and the corresponding property assignment, so, at this stage do not manipulate the property values of the control, because there is no value, During the loading process, we can operate on the control in the preload, if we want to before load.

Summary

In the process of describing the text to find, do not describe do not know, a description of the time, aware that they did not take the whole process of careful thinking, and then, after another look at the information, only to write these things, hope to the reader, but also suggest readers to consult some other information, to deepen their understanding.

Process description of the request processing response for an ASP.

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.