本篇主要讲述MVC处理请求时创建Controller和执行Action的完整过程。
创建Controller
先查看MvcHandler中处理请求的方法BeginProcessRequest:
protected internal virtual IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, object state) { IController controller; IControllerFactory factory; ProcessRequestInit(httpContext, out controller, out factory); IAsyncController asyncController = controller as IAsyncController; if (asyncController != null) { …… } else { …… } }
延伸阅读
学习是年轻人改变自己的最好方式