ASP. NET is a powerful platform for building Web programs. It provides great elasticity and capabilities so that it can build arbitrary Web programs. Many people only. NET high-level frameworks, such as WebForms and WebServices, are familiar. Therefore, in this article, I will elaborate on ASP. NET. and explains how to hand over requests from the Web Server to ASP. NET runtime, and then through ASP.. net http pipeline to process these requests.
Understanding the internal working mechanism of a platform will always make people feel satisfied and comforted. In-depth understanding can also help to write better programs. Knowing what the tools are for and how they are assembled as part of a complex framework will make it easy for you to find a solution to the problem, and when you modify and debug errors, are very important. The purpose of this article is to understand ASP. NET at the underlying layer and how requests flow into the ASP. NET processing pipeline. At the same time, we will understand the core of the ASP. NET engine and how a Web Request ends here. Many of the Knowledge mentioned here is unnecessary in your daily work. However, if you understand ASP.. NET.
Note: The entire ASP. NET engine is fully built in managed code, and all of its scalability is built through managed code.
Most people who use ASP. NET are familiar with WebForms and WebServices. These high-level implementations make it easy to build Web programs. ASP. NET is designed as a driver engine. It provides underlying interfaces to Web Server and provides routing services for front-end and end of high-level Web applications. WebForms and WebServices are built on the ASP. NET Framework and are the most common methods for HTTP processing.
In fact, at a lower level, ASP. NET also provides enough flexibility. The HTTP runtime and request pipeline provide the same capabilities to build implementations similar to WebForms and WebServices. Of course, these are already implemented using. NET hosted code. If you need to build a custom HTTP processing platform, which is a little lower than WebForms, then all these similar functions will be used.
WebForms is undoubtedly the easiest way to build most Web interfaces. However, if you want to customize a content processor or perform special processing on inbound and outbound content, or you need to customize an application server interface for an application, so using these low-level processing or modules will get better performance, in addition, you can gain more control in real request processing. Although some high-level implementations, such as WebForms and WebServices, have provided similar functions, performance is degraded due to the fact that they have added too much control over requests ). Therefore, you can create a different environment to process these requests at a lower level.
What is ASP. NET?
Let's start with the simplest definition. What is ASP. NET? I usually like to use the following statement to describe ASP. NET. ASP. NET is a mature engine platform that fully uses hosted code to process Web requests. It is not just WebForms and WebServices.
ASP. NET is a request processing engine. It obtains the client request and transmits the request to an end point through its built-in pipeline. At this end point, developers can add the logic code to process the request. In fact, this engine is completely separated from HTTP or Web Server. In fact, HTTP is a component during runtime. You can host it on an application outside of IIS. It can even be combined with other services. For example, you can host the HTTP runtime in a Windows desktop application.
By using the built-in pipeline to route requests, HTTP runtime provides a complex but elegant mechanism. Many objects are involved in each layer of request processing, but most objects can be extended through Derivation or event interfaces. Therefore, this framework is highly scalable. Through this mechanism, it is possible to enter lower-level interfaces such as cache, identity authentication, and authorization. You can filter the content before or after processing the request, or simply route the client request that matches the specified signature to your code or to another URL. For the same thing, you can use different processing methods, and the implementation code is very intuitive. In addition, HTTP runtime also provides the best flexibility between ease of development and performance.
The entire ASP. NET engine is fully built in managed code, and all the scalability functions are provided through the extension of managed code. For a powerful. NET Framework, using your own things to build a mature, high-performance engine architecture has become a testament. However, ASP. NET is most impressed by the ambitious design, which makes the work above it very easy and provides the ability to hook almost any part of request processing.
ASP. NET can be used to complete some tasks. Previously, these tasks were completed using ISAPI extension and filtering on IIS. Despite some restrictions, ASP has made great progress. ISAPI is the underlying Win32 API, and its interface only has 1 MB, which is very difficult for large-scale program development. Because ISAPI is the underlying interface, its speed is also very fast. However, enterprise-level program development is quite difficult to manage. Therefore, ISAPI serves as a bridge interface for other applications or platforms within a certain period of time. However, ISAPI is not discarded in any case. In fact, ASP. NET and IIS interfaces on Microsoft platform communicate with each other through the ISAPI extension of the host in. NET, and then directly access ASP. NET runtime. ISAPI provides core interfaces for communication with Web servers. ASP. NET then uses unmanaged code to obtain requests and send responses to client requests. The content provided by ISAPI is similar to HttpRequest and HttpResponse through public objects. It exposes unmanaged data by hosting objects through a well-designed and accessible interface.
- HTTP protocol analysis of ASP. NET Programming Model
- Analysis and Practice of ASP. NET Cache
- Analysis of ASP. NET database cache
- Analysis of ASP. NET Session usage
- ASP. NET Programming Model HTTP Working Principle