Illustration of the DOTNET framework: ASP. NET

Source: Internet
Author: User
Tags mscorlib

(Disclaimer: this series is intended for you only. the Net Framework is not an explanation of syntax and class usage. Therefore, you can only briefly describe the mentioned classes. If you have any questions, go to msdn to check)

How does the server (ASP. NET) work when it receives an HTTP request?

 

Let's take a look at the figure:

 

 

This figure is basically the same as the one shown in the previous article (to facilitate learning and memory, I have removed some less important things ).

Now let's analyze the ASP. NET running process.

 

 

Start from the first square: Start the IIS process. For IIS, it depends on a built-in driver called HTTP. sys.ProgramTo listen for external HTTP requests. When the operating system is started, IIS first registers its own virtual path in HTTP. sys. Actually, it is equivalent to telling HTTP. sys which URLs are accessible and which are inaccessible.
 

Second square: Select mscorewk to be loaded after the CLR has been selected. DLL or mscorsvr. mscorlib will be loaded later. DLL and the corresponding Worker Process (if the request is an accessible URL), HTTP. sys will send this request to the IIS worker process. Iis6.0is w3wq.exe, iis5.0is aspnet_wp.exe, and each worker process has an identity.

 

The third square: after the machine code is compiled, the command can be executed. systemdomain is created here, which contains the shareddomain and the default application domain, that is, the current application's own domain, as we mentioned earlier.. Net processes can contain multiple default application domains, which all use mscorlib. DLL. If it is loaded in each default application domain, it will undoubtedly cause a waste of memory, so there is a shareddomain, which is used to store the DLL used by all domains, this avoids a waste of memory. it also optimizes the loading speed.

 

The fourth square: In this case, the main method in aspnet_wp.exe will be found.

 

OK, I understand the Startup Process of ASP. NET. Let's take a look at what appdomain has done, or let's look at the figure:

 

 

 

1. httpruntime transfers the HTTP request to httpapplicationfactory, where the global. asax and compiled webapplication. global. aszx. CS compiles and generates httpapplication, which represents the web application we created. Httpapplication creates an httpcontext object for this HTTP request. This object contains many other objects related to this request, including httprequest, httpresponse, and httpsessionstate. These objects can be accessed through the page class or context class in the program.

2. httpapplication loads a series of modules based on Web. config. For example, the sessionstate module can intercept application_beginrequest to process the session. httpapplication will obtain httphandler and compile the requested ASPX page.

3. After the HTTP request passes through all modules, it will be processed by httphandler ., This is usually the logic completed by the. aspx. CS file. We know that the. ASPX page inherits from the page class, and the page class implements the ihttphandler interface. httphandler is also the lowest layer for HTTP request processing.

4. After httphandler completes processing, the HTTP request returns to the module again. At this time, the module can do some things after it has completed. ASP. NET has many paired events such as xxing and xxed. here is why ASP. NET can divide a XX operation into two parts, and then intercept the background principles of the event.

Next, let's take a look at the hierarchy of the classes most commonly used in ASP. NET applications.

 

 

 

Most of the <asp: XXX> controls we use are inherited from webcontrol, while the most basic HTML elements are inherited from htmlcontrol. The. ASPX page is inherited from the page class.

The ASP. NET page of MS is similar to winform and composite. For more information, see Figure 7: winform in the graphic DOTNET framework.

 

Next article: Illustration of the DOTNET framework: WPF

 

 

Related Article

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.