First, the browser and server interaction principle
( i ), a simple description of browser and server interaction:
1. Popular Description: We usually access the website through the browser, in fact, you go through the browser to access a computer on the same access to files, but the browser's access request is accessed by a computer on a WEB server software To receive processing, it parses the received request information to locate the file on the server computer according to the requested information, processes it, and eventually sends the generated content back to the browser.
Simply put: By the browser generated a "command", the Internet to another computer software ( Server Software), theServer software received "command", the analysis to understand the "command", and then follow the "command" to locate the file on the server computer, the file content sent back to the browser.
2. through, we see a simple process of browser and server interaction. Now, we have to think about the browser and server Software is God horse East, how do they interact with information?
In fact, the browser and server software is two separate applications ( just like QQ, Office, paint tools). The interaction between the two applications involves the application communication problem. What about the way they communicate with God's horse?
The answer is socket:socket. As for the specific use and principle of sockets, the length of the question is not written in this article, first reserved location in this, next time to make up the "multi-threaded and socket-based simple WebServer software - There is no control for ASP.
browser and server software send and receive information via sockets, But now the key question is, What exactly are they sending and receiving?--- based on Http message data Http protocol introduction --- No controls for ASP. NET "
In other words: the browser and server Software is actually two of the two applications that use the Socket to communicate : Both are sent in accordance with the Http The protocol Syntax specification organizes the data, which is interpreted according to the Http protocol syntax specification after receiving the data .
( two ) , browsers, and IIS (or other webserver) Interaction Mechanism
is that IIS ( Server Software )
1. Browser and IIS interaction process:
We all know that on the Internet to determine the location of a computer using IP addressing, but why when we usually visit the site directly into a domain name can also access to a server computer and then by the other party's server software to send response page data to me? I'll list the simple steps below:
(1) In the browser input URL: www.oumind.com/index.html, the browser according to the HTTP protocol syntax to generate the request message data.
(2). The browser checks if the www.oumind.com/index.html is saved by the machine. the server IP address that corresponds to the domain name . If not, it sends the request to the nearest DNS server in the City Network (the domain name resolution Server), which will be sent back to the server according to the domain name we send to the IP address of the domain name , and then send to the browser.
(3) browser from Dns request message Send to server PC. (Note: Http Agreement request message port, and the server is responsible for listening to this port software is generally server software- example asp.net< Span style= "font-family: the song Body;" > Iis,java Tomcat
(4) Iis received send back to the browser.
(5) However, if a dynamic page (. aspx/.ashx) is requested at this time, IIS will not be able to handle it itself ( because the ASP does not exist when the IIS software is developed ) . So, IIS goes to its extender mapping table to see if there are extensions that can handle such files based on the requested file suffix name .
The files that are commonly used in our ASPNET are aspnet_isapi.dll. Aspx/.ashx and other corresponding handlers. Such as:
(6) If IIS finds the corresponding handler based on the suffix, it calls the program to process the request message sent by the browser.
As for, then what to do, please continue to follow:
The ASP. NET operating mechanism principle 02_asp. NET overall operating mechanism 01 from browser to HttpApplication---No control for ASP.
Reprint please indicate the source: the principle of ASP.---the interactive process between the browser and IIS open the network http://www.oumind.com
ASP. NET page run mechanism and request processing flow
IIS itself cannot handle pages such as the ASPX extension, and can only request static files such as HTML to handle pages with an ASPX extension because IIS has an ISAPI filter, which is a COM component. Asp. NET service when registering to IIS, a Win32 Extended dynamic library Aspnet_isapi.dll is added. and registers the extension with a page extension (such as ASPX) that can be processed inside IIS. After the extension is started, pages that are not processed by IIS are handled in a defined way.
When a client requests a server resource, the HTTP request is intercepted by the Inetinfo.exe process (WWW service), then the check requests the type of the resource and depends on the resource mapping information (stored in the IIS Meta-Library, an IIS A dedicated configuration database) assigns the requested resource to a specific handler module. If the requested static resource (img,text,html, etc.) is handled by IIS (IIS accesses the requested file on the local Web server), the content is output to the console, and the requesting browser is able to receive it. If a request is to be processed on the server side, it will be uploaded to the registered extension, and the ASPX request will be assigned to Aspnet_isapi.dll, allowing the program to start processing the code, generate standard HTML code, and then add the HTML to the original HTML. Finally, the full HTML is returned to Iis,iis and the content is sent to the customer's browser.
The ASP. NET Framework handles the request:
It says that IIS assigns a page like aspx to Aspnet_isapi.dll, which is then handled as follows:
1. Aspnet_isapi.dll will send this HTTP request to W3wp.exe via an HTTP pipeline pipeline (the IIS worker process, called w3wq.exe,iis5.0 in IIS6.0), This HTTP request is then processed by the ASP. HttpRuntime.
2. httpruntime first determines the class name for processing the request, and httpruntime calls the class through the public interface IHttpHandler to obtain an instance of the class of the requested resource.
3. Call Httpruntime.processrequest to start processing the page to be sent to the browser, specifically to create an HttpContext instance that encapsulates all the HTTP-specific information about the request and initializes a write object for caching the tag code.
4. httpruntime uses contextual information to find or create a new object that can handle the request's Web application. The HttpApplication factory is responsible for returning the HttpApplication instance.
5. The HttpApplication instance reads the configuration of all HttpModule in Web. config.
5. The HttpApplication object uses an instance of the IHttpHandlerFactory type to return the HttpHandler (HTTP handler) to the HttpRuntime object. A page is just an HTTP handler object.
6. The ProcessRequest method that finally calls IHttpHandler's Page object by the HttpRuntime object.
Asp. NET operating mechanism principle---the interaction between the browser and IIS the process of their own study on the internet to find out the summary of the other people to write a good turn over and write their own well in the hehe