本篇主要講述MVC處理請求時創(chuàng)建Controller和執(zhí)行Action的完整過程。
創(chuàng)建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 { …… } }
延伸閱讀
學(xué)習(xí)是年輕人改變自己的最好方式