1..net mvc principle overview, 1 .. netmvc Overview

Source: Internet
Author: User

1..net mvc principle overview, 1 .. netmvc Overview

The request is received by the iis server based on the ip address and port. If the request is a static file, the file content is directly returned. If the request cannot be parsed, the corresponding request suffix is found based on the ing rule.

The ASPNET_ISAPI.dll processing assembly for processing.

1. IsapRuntime is generated, and the WorkRequest object is created,

2. Next, instantiate HttpRunTime and generate the HttpContext context object. At this time, the built-in objects such as Request, Response, Session, and Application are initialized,

3. Then the HttpApplicationFactory factory object is created. During the first access, it calls the Application_Start method in the Global File,

Generate an HttpApplication object, read the system configuration file, including our route configuration and constraints, create an HttpModel object, call the Init method, and register these methods into the pipeline,

4. ProcessRequest is called by the HttpApplication object, which executes the pipeline time.

4.1 The first event is the BeginRequest method, and then the key point is to create the MVCHandler object at 7th times,

4.1.1 store HttpContext in it, read the routing rules in the route table to generate RouteData objects, and store them together with HttpContext to create RequestContext, and then pass the RequestContext object to RoudlerHandler. getHttpHandler obtains MVCHandler and calls context. remapHandler saves mvchandler to httpcontext

4.2 8th Events Check whether RemapHandler in HttpContext is empty. If not empty, skip this event, which is also one of the most important differences with aspx, in aspx, we want to create a Page Control tree. however. net mvc is skipped here

Between 4.3 and 11th events, a controller object is created based on the Controller name obtained from the Controller factory, And the RequestContext is passed in to call the ControllerBase Execute method of the controller parent class, set RequestContext to ControllerContext and execute the ExecuteCore method. Find and call the corresponding Action method based on the request method name, that is, the business we write, and return the View, actionResult is called. execute method, that is, ViewResultBase of the parent class. executeResult: Find the corresponding View engine, get the View object of ViewEngineResult, get the TextWriter object and ViewContext object of Response to call the Render method of the engine, generate html code, and writer it out.


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.