Asp. NET application life cycle amusing (ii)

Source: Internet
Author: User
Tags httpcontext microsoft website

At the beginning of the last book, we mentioned that IIS at the Blog Park took a look at my request and gave it to ASP . And asked for the HTML to be returned after ASP. for display.

Then we have to ask not only:

1, IIS must have no eyes, then it is how to "see" it?

2, after the "see" to the. aspx page request, then how to give it to the ASP? What's the point of being there without any treatment?

3, ASP. NET receives this processing request and how to do it? How does it create a context object and how to "hire" the project manager HttpApplication object?

This article will carry on the thorough and simple discussion to these questions.

When you click on the link to this article, in a short period of time the blog Park IIS received your request. It's going to "see". As we know, it has no eyes, so it relies on the ISAPI to "see" the suffix of the request. We're asking for this. aspx file. ISAPI is the full name of inernet Server application programe Interface, which is the eyes and routers of IIS, first look at the suffix and then distribute to each application, we can access the IIS site's properties-"Home directory-" configuration to view its route map.

We found that in the executable path corresponding to the. aspx extension, the real processing of the ASP. NET application is Aspnet_isapi.dll. Can clearly see, it can also handle asax,ascx, ASHX, ASD,BROWER,CD and so on a bunch of ah, really powerful.

However, in the way of "looking", IIS5 and IIS6 there are some differences.

IIS5 by Inetinfo.exe Process in TCP Port (the default is ) to "see" the request that came in. . As we have just seen, if these request is aspnet_isapi.dll to handle, then Aspnet_isapi.dll is created ( Not sure worker process is aspnet_isapi.dll created, but they interact through named pipes and constantly monitor a aspnet_wp.exe process, which is the most important component of ASP: Worker process. Almost all of the work was done in this process, and it was renamed W3wp.exein IIS6.

IIS6 http. sys in kernel mode to "see" the request that came in. . HTTP. SYS sends incoming request to the appropriate applicationpool(application pools). The application pool then passes the request to Aspnet_isapi for the work of creating worker process . The worker process in IIS6 is already w3wp.exe .

What happens next in the most important worker process? How did HttpApplication, the project manager, get hired? Please listen to me slowly.

Aspnet_isapi after the worker process has been created and the CLR has completed the layout of the managed environment, it doesn't matter. The worker process starts to manage everything, and it gives all the work to the httpruntime. Finally, HttpRuntime hired the project manager HttpApplication. Then, httpruntime is not doing any work, it has created all the HttpModule through the configuration file and fills in the HttpApplication "work list", the project manager Httpapplicaiton the work according to this list. HttpRuntime also created the HttpContext box and handed it to the project manager HttpApplication. Chubby Now we finally understand the phrase "ASP. NET created HttpContext". Now summarize what httpruntime has done:

1, created HttpContext this box to store request and response

2, set up the work list HttpModule

3, hired the project manager HttpApplication and handed the box context to it, and then the work list as a performance assessment list also to him.

4, waiting to return the result .

PS: In this process, in fact there are more detailed process, but I think that helpless and we understand the real important things, but will bring higher difficulty, so also did not write. Interested cheese can go to the Microsoft website to search for related resources.

Next, the "project manager" HttpApplication to believe that we have already learned something in the previous article, what? Didn't look? Then hurry to see it.

Welcome to the Brick, please.

Asp. NET application life cycle amusing (ii)

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.