The Action method has two basic forms: Synchronous execution and asynchronous execution. the entire system of NETMVC involves many synchronous/asynchronous execution methods. Although this has been introduced in the previous article, in order to give readers an overall understanding of this, let's make a summative discussion.
1. MvcHandler synchronization and Asynchronization
For ASP. net mvc applications, MvcHandler is the final HttpHandler used to process requests. It uses UrlRoutingModule, which enables the HTTP module of URL routing to be dynamically mapped to the corresponding request. MvcHandler activates and executes the target Controller with the help of ControllerFactory, and releases the activated Controller after the execution ends. For related content, see Chapter 1 "Controller activation" in this book ". As shown in the following code snippet, MvcHandler implements both the IHttpHandler and IHttpAsyncHandler interfaces, so it always calls the BeginProcessRequest/EndProcessRequest method to process requests asynchronously.
- Public class MvcHandler: IHttpAsyncHandler, IHttpHandler ,...
- {
- // Other members
- IAsyncResult IHttpAsyncHandler. BeginProcessRequest (HttpContext context, AsyncCallback cb, object extraData );
- Void IHttpAsyncHandler. EndProcessRequest (IAsyncResult result );
- Void IHttpHandler. ProcessRequest (HttpContext httpContext );
- }