IIS internal operation mechanism

By Alex Howard,2015-12-12 03:03
16 views 0
IIS internal operation mechanism

    IIS internal operation mechanism

    ASP.NET is a very powerful build Web application platform, it provides a great deal of flexibility and power so that it can be used to build all types of Web applications.

    The vast majority of people only familiar with high-level framework, such as: WebForms and WebServices - these are top of the hierarchy in ASP.NET.

    This article of the data collected from a variety of Microsoft made a public document, by comparing IIS5, IIS 6, will the three generations of IIS the request processing, let we are familiar with the underlying mechanism of ASP.NET and the request (request) is how to transfer from a Web server to the ASP.NET runtime.Through the understanding of the underlying mechanism, we can have deeper understanding on

    IIS 5 request processing

    The interpretation of the figure:

    IIS 5. A significant feature x is a Web Server and the real separation of ASP.NET Application.As a Web Server IIS running in a group called InetInfo. Exe, on the Process of InetInfo. Exe is a Native Executive, not a managed Application, and we really ASP.NET Application is running in a place called the aspnet_wp Worker Process above, in the Process of initialization loads the CLR, so this is a managed environment.

    ISAPI: refers to the application that can handle the various suffix.ISAPI is the abbreviated words below: Internet Server Application Programe Interface, Internet Server Application programming Interface.

    The characteristics of the IIS 5 mode:

    1, first of all, at the same time can only run on the same host a aspnet_wp Process, each ASP.NET Application based on virtual directories corresponding to an Application Domain, which means every Application running on the same Worker in the Process, the isolation between Application is based on the Application Domain, rather than on the basis of the Process.

    2, secondly, the ASP.NET ISAPI not only responsible for creating aspnet_wp Worker Process, and is responsible for monitoring the Process, if detected aspnet_wp Performance is reduced to a lower limit set, the ASP.NET ISAPI will be responsible for the end of the Process.After the aspnet_wp end off, subsequent Request will cause the ASP.NET ISAPI recreate new aspnet_wp Worker Process.

    3, finally, because the IIS and Application running in the process of their own, the communication between them must adopt specific communication mechanism.Essentially in IIS InetInfo Process and the Worker Process is the communication between different processes on the same machine communication (local interprocess communications), in the consideration of the Performance, between them based on Named pipe communication mechanism.Communication between the ASP.NET ISAPI and the Worker Process through a set of Pipe between them.In the Performance of the same reason, the ASP.NET ISAPI will by means of the asynchronous Request to the Worker Process and get the Response, but the Worker Process is by synchronizing the way to the ASP.NET ISAPI some variables based on the Server.

    Iis 6 request processing

    The interpretation of the figure:

    IIS 5. X is through InetInfo. Exe to monitor the Request and distributed the Request to the Work Process.. In other words, in IIS 5 x monitoring and distribution of the Request is done in User Mode, in IIS 6, this kind of work were transplanted into the Kernel Mode, all this is through a new component - HTTP. Sys.

    Note: in order to avoid the User application to access or modify the operating system of the key data, Windows provides two processors access modes: User Mode (User Mode and Kernel Mode (Kernel Mode).Generally, the User program runs in User mode, and the operating system code to run in Kernel mode.Kernel Mode code allows access to all system memory and CPU instructions.

    Under the User Mode, HTTP. Sys receive an HTTP request, based on the aspx it then according to the IIS Metabase view based on the request of Application belongs to which the Application Pool, if the Application Pool does not exist, create it.Otherwise the request directly to the corresponding Application Pool in the Queue.

    Each Application Pool corresponds to a Worker Process - w3wp. Exe, there is no doubt that he is running in User Mode.In the IIS Metabase maintained the Application Pool and the Worker Process Mapping.The WAS (Web Administrative Service), according to such a mapping will exist in a certain Application Pool

    of the Queue request is passed to the corresponding Worker Process (if not, they create such a Process).The Worker Process initializes, load the ASP.NET ISAPI, ASP.NET ISAPI and then load the CLR.As the final process and IIS 5. X: through AppManagerAppDomainFactory Create methods for Application to Create an Application Domain;Through the ProcessRequest ISAPIRuntime processing Request, then will flow into the ASP.NET Http Runtime Pipeline.

    IIS 7 request processing

    Will site launch and process the request below step:

    Step 1 to 6, it is processing applicationsstart,start, don't need to walk again after this step.

    Above 8 steps are as follows:

    1, when the client browser to HTTP request to a WEB server resources, HTTP. Sys to intercept the request.

    2, HTTP) sys contact WAS get configuration information.

    3, WAS to configure the storage center (applicationHost. Config) request configuration information.

    4, the WWW service receives the configuration information, configuration information refers to the similar application pool configuration information, site configuration information, and so on.

    5, the WWW service. Use the configuration information to configure the HTTP sys processing strategy.

    6WASstarts a worker process for the application pool to which the request was made.

    7The worker process processes the request and returns a response to HTTP.sys.

    8, the client accept information to process the results.

    W3wp.exe process is if handled?IIS application pool of 7 managed pipeline model is divided into two types: classical and integration.The two modes adopted different strategies.

    IIS 6 and will classic mode managed pipeline architecture

    Before will ASP.NET in IIS ISAPI extension way plus to IIS, including ASP and PHP, actually also are in the same way with (PHP in IIS adopted two kinds of configuration mode, in addition to the IIS ISAPI extension, also includes the way the CGI, system administrators can choose PHP execution way), so the client of IIS HTTP request will be processed by IIS, then IIS content types according to the requirement, if it is a static HTML web pages by IIS to handle, if not, just depending on the type of content requirements, assigned to the respective IIS ISAPI extension;If the requirements of the content type is ASP.NET, ASP.NET is assigned to handle the IIS ISAPI extension, namely aspnet_isapi. DLL.Below is the architecture diagram.

    IIS 7 application pool managed pipeline mode "classic" is such a principle.This model is compatible with IIS 6 ways to reduce the cost of the upgrade.

    Iis 6 execution architecture diagram, as well as will application pool configured to classic mode execution architecture diagram

    IIS 7 application pool managed pipeline mode - integration mode

    After the IIS 7 fully integrated architecture have made a lot of different processing order (pictured), the main reason is ASP.NET from IIS plug-in (ISAPI extension), the role of entered the IIS core, but also can with a lot of type of module is responsible for handling the IIS 7 ASP.NET.These modules not only deal with ASP.NET ASP.NET web application, also can handle such as ASP, PHP or other static HTML pages, but also because of several functions in ASP.NET has become a part of IIS 7, so the ASP, PHP or static HTML pages and other types of request, can also use like Forms Authentication (Forms Authentication) or Output caching (the Output Cache) and the functions of ASP.NET 2.0 (but must modify the Settings of IIS 7).Because IIS 7 also allow themselves to ASP.NET API development and add module, so ASP.NET web developers will be easier to expand the IIS 7 and function of web applications, even to their own. NET write management IIS 7 applications (for example in process control IIS 7 build web site or virtual directory).

Execution of IIS 7 architecture diagram (integrated managed channel mode

of architecture)

Report this document

For any questions or suggestions please email