Learn the ASP. NET MVC framework secret Note-iis/asp. NET Pipeline (i)

Source: Internet
Author: User
Tags metabase

Iis/asp.netPiping

ASP. NET MVCis built onASPplatform based onMVCmode ofWebapplication framework, in-depth understandingASP . NET MVCthe premise is toASPa deep understanding of piping design. BecauseASP . NET Webapplications are mostly hosted inIIS, the next step is to introduce3a majorIISversion to the respectiveWebhow the request is processed.

1.3.1 IIS 5.x and asp .

IIS 5.x runs in process InetInfo.exe , a process hosted by a world wideweb Publishing Service(abbreviated as w3svc) for Windows Services. the w3svc is primarily responsible for monitoring, activating, and managing the HTTP requests, loading the configuration (via the Metabase Load related configuration information), and so on.

When you detect aHTTPwhen requested,IISa static resource is judged by the extension first, such as. html,. IMG,. txt,. XMLetc.) or dynamic resources. For the former,IISThe content of the file responds directly to the client, for dynamic resources such as. aspx,. asp,. PHPand so on) are extended fromIISthe script map (Script Map), locate the appropriateISAPIDynamic link library (Dynamic Link Library,DLL).

Isapi(Internet Server application Programming Interface) is a set of local (Native)Win32API, isIISand other dynamicWebthe link between the application or the platform. ISAPIdefined in a dynamic link library (DLL) file,ASP . NET ISAPIcorresponding to theDLLfilename is calledAspnet_isapi.dll. ISAPISupportISAPIExtending andISAPIfilter. The former is really handlingHTTPThe requested interface, which can beHTTPRequests are viewed, modified, forwarded, or rejected before the request is actually processed, such asIIScan take advantageISAPIcan take advantageISAPIFilter the validation for the request.

If we are asking for aASPtypes of resources, such as. aspx,. asmx,. svc, ETC.,Aspnet_isapi.dllwill be loaded,ASP . NET ISAPIyou will then createASPworker process (if the process has not been started). Foriis5.x, the work process isAspnet.exe. IISThe process communicates with the worker process through a named pipe.

during the initialization of a worker process, .net runtime ( clr web application initial request, Span style= "Font-family:times New Roman" >clr http The runtime is loaded and used to create the appropriate app. Hosted on iis 5.x all web applications are running in the same process (worker process aspnet.exe ) in different application domains.

1.3.2iis6.0 and asp .

Through the previous introduction, we can see that there are at least two deficiencies in iis5.x.

The 1.ISAPI dynamic link library is loaded into the Interinfo.exe process, which is a typical cross-process communication between the worker processes, although named pipes are used, but still lead to performance bottlenecks.

2. All asp.net application running in different application domains of the same process, application-domain-based isolation does not fundamentally address the impact of one application on another, and in more cases we need different web applications run in different processes.

iis6.0 will isapi The dynamic link library is loaded directly into the worker process. In order to solve the second problem, in iis6.0 The mechanism of application pooling is introduced in the. We can create an application pool for one or more web app. Not one application pool corresponds to a separate worker process ( w3wp.exe that runs in different application pools web application provides a process-level-based isolation mechanism.

In addition to the above two improvements, iis6.0 There are some other commendable places, the most important of which is the creation of a named http. SYS http listener. http. SYS runs in the form of a driver in window WINDOWTCP/IP part of the network subsystem, structurally it belongs to tcp

strictly speaking, HTTP. SYS already does not belong to iis http. SYS configuration information is also not saved in iis Meta-database for span style= "font-family: Arial" ( metabase http. SYS

1. Continuous monitoring. Because of HTTP. SYS is a network driver that is always running the program, so it responds to the user's HTTP requests in a timely manner.

2. Better stability. HTTP. SYS runs in operating system kernel mode and does not execute any user code, so it is not inherently affected by Web apps, worker processes, and IIS processes.

3. The data cache in kernel mode. If a resource is requested frequently,HTTP. SYS caches the content of the response, and the cached content responds directly to subsequent requests. Because this is a kernel-based cache, there is no kernel-mode and user-mode switching, and the response speed will be greatly improved.

When the warden hearsHTTPwhen requested,HTTP. SYSDistribute it tow3svc,the latter resolves the requestedURL, and according to theMetabaseGets theURLwith theWebthe mapping relationship between applications gets the target application, which gets the application process pool or worker process that the target application runs. If the worker process does not exist (it has not been created or reclaimed), it creates a new worker process for the request. During the initialization of the worker process, the correspondingISAPdynamic link libraries are loaded, forASPFor applications, the loadedISAPI.dllto beAspnet_isapi.dll. ASP . NET ISAPIBe responsible forCLR, application domain creation, andWebthe initialization of the app, among other things.

In the next chapter, we'll explain IIS7.0 and ASP.

Learn the ASP. NET MVC framework secret Note-iis/asp. NET Pipeline (i)

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.