MVC series (1) into the CLR

Source: Internet
Author: User

The sequence of things before MVC, is the author in the early 2012 to read the MVC3 source of the collation, mainly on the HTTP request to enter the Mvchandler before the content, including the original, translation, reprint, collation and other types of articles, of course, also referred to the blog park, a number of Daniel's article, Thank you for this, I have time to post it, hope to be useful to everyone.

Main content

This article explains how the server, after accepting HTTP request requests, is going into the. Net CLR for further action.

As we all know, IIS must accept the request before it can have access to the CLR, but it is poorly understood how the request was routed from the Web server to the ASP.net runtime. Due to the different versions of IIS, which may be different in the way it enters the CLR, this section will explain the way in which the three versions of IIS5/6/7 are entered, and by understanding these underlying mechanisms, we can have a deeper understanding of asp.net.

The asp.net request processing process for IIS 5

The IIS5 core feature is that IIS is allowed on a process called InetInfo.exe, so both ASPX pages and HTML pages are processed through this process, where the ASPX page extension is mapped to the ASPNET ISAPI. DLL, so if the page is ASPX, the ASPNET ISAPI. DLL creates aspnet_wp this worker Process and loads the CLR at initialization time, so this is a managed environment.

The points to be noted are:

The same server can only run one aspnet_wp process, meaning that all asp.net Web application are in the same worker process, but that does not mean they share the same context and database, ASP. NET has a AppDomain concept, each site or virtual directory corresponds to a separate AppDomain, each AppDomain is isolated, has its own context of independent contexts, so security is no problem, So our conclusion is that the ASP.net program continues to be AppDomain, not based on process.

ASP.net ISAPI is responsible not only for creating aspnet_wp Worker processes, but for monitoring the process, and if the performance of aspnet_wp is detected to be lowered to a set lower limit, ASP.net ISAPI will end the process, When the request comes, the ASP.net ISAPI will re-create the new aspnet_wp Worker Process.

Since IIS and application are running in their respective processes, communication between them must be based on a specific communication mechanism. Because the communication between the machines is different from the process of communication (local interprocess communications), in the performance of consideration, they adopt a communication mechanism based on named pipe. Communication between the ASP.net ISAPI and the worker process is implemented through a set of pipe between them. Also in the performance, ASP.net ISAPI passes the request to the worker process and obtains the Response asynchronously, but the worker process is synchronized to the ASP.net ISAPI Some server-based variables.

The asp.net request processing process for IIS 6

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.