Asp.net large file upload (1)
Wu jian2010-4-19
Reprinted please indicate the source: http://www.cnblogs.com/wu-jian/
1. Preface
This article systematically describes the basic knowledge. net large file upload solution, hope to provide help to people in need, at the same time introduce IIS, HTTP pipeline, Asp. net pipeline has some relatively low-level knowledge and limited personal capabilities. please correct me if you have any shortcomings.
2. Http MPs queue
2.1. ISAPI
When you type a URL in your browser, click a hyperlink, or submit an HTML form, iis5 or IIS6 will receive this request on the server side, different ISAPI extensions are used to process different request URL extensions, as shown in:
ISAPI is the underlying unmanaged Win32 API, which defines a very single interface and has the best performance. Developers and third-party vendors can use these interfaces to go deep into IIS. Because ISAPI is very low-level, it is not suitable for building application-levelProgram. ISAPI tends to be used as a bridge interface to provide application service functions for high-level tools. For example, Apache and Tomcat running on IIS are built on ISAPI. ISAPI is a very good tool. It provides a high-performance vertical access interface for high-level applications, so that the information required by high-level applications can be extracted from the information provided by ISAPI. In ASP and ASP. NET, the engine can extract the objects in the forms provided by the ISAPI, such as request and response. These objects can read their respective contents from the ISAPI request information. ISAPI is the first IIS entry point with the highest performance in custom web request processing.
2.2. ISAPI extension
As agreed, ISAPI supports ISAPI extensions and ISAPI filtering (filters ). An extension is a request processing interface that provides logic processing related to Web Server input and output. Essentially, it is a transaction interface. asp and ASP. NET are both seen as implementation of ISAPI extensions. ISAPI is a hook interface that allows you to view every request sent to IIS and modify the request content (including input and output ).
ASP. net isapi is extended to aspnet_isapi.dll, as shown in:
2.3. iis5 and IIS6
When An ASPX request arrives at IIS, it checks the script ing and routes the request to aspnet_isapi.dll. What is the next operation on this DLL file? In iis5 and IIS6, how does this request reach ASP. NET runtime? Are there any major changes in the Processing Methods of the two?
In iis5:
1. When a request from the client enters IIS, IIS tries to find an extension ing Based on the requested URL. If a. aspx URL is found, the request is sent to aspnet_isapi.dll.
2. isapi dll is connected to ASP. NET worker processes through some named pipelines.
3. ASP. NET passes the request to a specified appdomain
4. Start ASP in appdomain. net pipeline process. This process goes through a series of steps, and the final result is to pass the request to the endpoint (endpoint)-We wrote. aspx. CS class, which is derived from page and implements the ihttphandler Interface
In IIS6:
IIS no longer directly hosts any external executable code like ISAPI extensions. Instead, IIS always maintains a separate working process: application pool. All processing occurs in this process, including the execution of isapi dll. For IIS6, application pools are a major improvement because they allow smaller granularity to control the execution of a specified process. You can configure an application pool for each virtual directory or the entire web site, which makes it easy for you to isolate each application into its own process, in this way, it can be completely isolated from other programs running on the same machine. From the perspective of Web processing, if a process dies, at least it will not affect other processes.
Next article: Asp.net large file upload (2)