Tuesday, October 5, 2010

ASP.NET introduces the underlying working mechanisms



ASP.NET work on the underlying mechanism, recently discussed the garden is very hot. I believe many people have seen Mr. Rick Strahl's a classic: A low-level Look at the ASP.NET Architecture, by Rick Strahl agree, I took his article translated into Chinese, hoping to give to understand ASP.NET working mechanism of a friend a little help.

Special Note: The purpose of this article translated only to a large number of ASP.NET fans help, because my limited capacity, the paper does not place, please also criticized the correction. If you need to reprint, please retain the original English text and links. Thank you!

Directory

1. ASP.NET What is this?

2. From the browser to ASP.NET

3.ISAPI connection

4.IIS5 and the difference between IIS6

5. Enter. NET Runtime

6. Loading. NET-a little bit mysterious

7. Back to the run-time

8.HttpRuntime, HttpContext and HttpApplication

9.Web the main part of the program: HttpApplication

10. Through the ASP.NET pipeline

11.HttpContext, HttpModules and HttpHandlers

12.HttpModules

13.HttpHandlers

14. It has provided sufficient underlying knowledge?

Summary: ASP.NET is a Web program for building a powerful platform that provides tremendous flexibility and capability so it can build any of the Web program. Many people only on high-level framework in ASP.NET, such as: WebForms and WebServices are more familiar with, so in this article, I will explain the relatively low-level knowledge of ASP.NET, and will explain how to request from handed over to the ASP.NET Web Server is running, then ASP.NET HTTP pipeline deal with these requests.

For me, to understand the inner workings of a platform always makes me feel some satisfaction and comfort, as insight, you can help me write a better program. Know the tools of any use, as well as their on how to assemble into complex part of the framework, which will make you very 瀹规槗 find Wen Ti of the solution Fang An, as well as in the Ni Xiugai and debug errors O'clock, they both looked very 閲嶈. The purpose of this article is from the bottom to understand ASP.NET and how to help you understand the request into the ASP.NET processing pipeline inside. At the same time, you will understand the ASP.NET engine core, and a Web request to end here. Many of knowledge are referred to here you do not need to know daily work, but if you understand how to route requests to the ASP.NET application code in (usually higher level), it is useful to you will .

Note: the ASP.NET engine completely built in managed code, all of its scalability is through managed code to build.

Most of use are more familiar with ASP.NET WebForms and WebServices. These high-level implementation, so much easier to build Web program. ASP.NET is designed to drive the engine, it is the underlying interface to the Web Server, for high-level Web application front-end and end to provide a routing service. WebForms and WebServices framework is built on top of ASP.NET, the HTTP address of the two most commonly used methods.

In fact, in the lower level, ASP.NET also provides enough flexibility. HTTP request pipeline run-time and provide the same capabilities, like WebForms and WebServices to build the realization, of course, these have been used. NET managed code achieved. If you need to build a custom HTTP processing platform, rather than WebForms this platform in which a lower level, then you will use all of these similar features.

Most of the Web interface built using WebForms is undoubtedly the easiest way, but if you want to customize a content processor, or the need for inflow and outflow of the contents of the special processing to do, or need a custom application, an application server interface, then use these low-level processing or modules will be better performance, as well as request processing in a real gain more control. Despite the high level of implementation, such as: WebForms and WebServices have provided similar functionality, but because they are too much for the request to add the control (resulting in performance degradation). So you can open up nirvana, at the lower levels to deal with these requests.

What is ASP.NET?

Let us start from the most simple definition, ASP.NET? I usually like to use the following statement to describe the ASP.NET.

ASP.NET is fully managed code handling Web requests using a mature engine platform. It is not just WebForms and WebServices.

ASP.NET is a request processing engine. Access to client requests it, and then through its built-in channels, the request reached an end point, in the end, developers can add logic to deal with this request code. In fact the engine and the HTTP or Web Server is completely separate. In fact, HTTP runtime is a component, you can host it in IIS on the outside of the application. Or even other services can be combined. For example, you can host HTTP runtime in the Windows desktop application (detailed information, please see: http://www.west-wind.com/presentations/aspnetruntime/aspnetruntime.aspx).

Pipeline route by using the built-in request, HTTP runtime provided a complex, but very elegant mechanism. In every aspect of processing the request involves many objects, most objects can be derived, or to extend the event interface. Therefore, this framework has very high scalability. A mechanism through which you can enter the lower level interfaces such as: caching, authentication, authorization is possible. You can process the request before or after the filter content, or simply to match the signature of the designated route client requests directly to your code or switch to other of the URL. For the same thing, different treatment can be completed, and implementation code are very intuitive. In addition, between the ease of development and performance, HTTP operation is also offered the best flexibility.

The ASP.NET engine completely built in managed code, all of the extensibility features are provided by the expansion of managed code. For powerful. NET framework, the use of their own things, to build a mature, high-performance engine architecture has become a testament. Nevertheless, it is important that, ASP.NET is the most impressive design vision, which makes its very easy to work on, and provides almost any part of them hook request processing capacity.

ASP.NET can be used to complete some tasks, these tasks is to use the IIS before the ISAPI extensions and filters to complete. Despite some limitations, but compared with the ASP has made great progress. ISAPI is a low-level Win32-style API, only its interface there is a trillion, that the procedure for large-scale development is very difficult. Because ISAPI is a low-level interface, so its speed is very fast. But for enterprise-level application development is quite difficult to manage. So, in a certain period of time, ISAPI, or other applications as the main platform of the bridge interfaces. But in any case, ISAPI is not abandoned. In fact, Microsoft's ASP.NET and IIS platform interface is through the host. NET in the ISAPI extension to communication, and then directly to ASP.NET runtime. ISAPI provides the core of communication with the Web Server interface, and then use non-managed code for ASP.NET requests and send response to client requests. ISAPI content provided by the public objects similar to the HttpRequest and HttpResponse, through a well designed, accessible interface to managed objects in the way of exposure to non-managed data.

ASP.NET from the browser to let us from a typical ASP.NET Web request life cycle starting point. Users type in the browser by a URL, click on a hyperlink, an HTML form submit (a post request), or a client program calls the ASP.NET-based WebService (ASP.NET available through the service). On the server side, IIS5 or IIS6 will receive the request. The underlying ASP.NET IIS through ISAPI extension and communication, and then, through the ASP.NET, the request is often routed to one with. Aspx page extensions. However, the process of handling the work is entirely dependent on the HTTP processor (handler) implementation. The processor will be installed to handle the specified extension. In the IIS in,. Aspx through the "application extension" is mapped to the ASP.NET ISAPI dll file: aspnet_isapi.dll. Each ASP.NET request is triggered, must be registered by one, and point to aspnet_isapi.dll extension to identify.

Note: ISAPI is a custom Web request processing in the first and highest performance of the IIS entry point.

Rely on extensions, ASP.NET to a request routed to an appropriate processor, which is responsible for processing the request. For example, WebServices extension. Asmx will not route requests to a disk on a particular page, but will be routed to the specified in the definition of additional features (WebMethodAttribute) class, this feature will identify it as a Web Services implementation. Many other processors will be installed together with ASP.NET. Of course, you can define your own processor. HttpHandler in IIS is mapped in all, and point to ASP.NET ISAPI extension, and these are all HttpHandler in web.config configuration, used to route requests to the implementation of the specified HTTP handler. Each processor is a. NET class to handle the specified extension. These processors can handle only a few simple lines of code to the Hello World, also to a similar complex ASP.NET page and the implementation of WebService. For now, just need to understand the expansion is a basic mapping mechanism, ASP.NET ISAPI in use it can get a request and then route requests to the specified processor to handle the request.







相关链接:



MPG to 3GP



M2TS converter



ASF to MOV



Computer Clean Up Software Review How To Scan



No comments:

Post a Comment