MVC请求生命周期

mac2022-06-30  65

简单流程:

Request 请求到来 IIS 根据请求特征将处理权移交给 ASP.NET UrlRoutingModule 将当前请求在 Route Table 中进行匹配 UrlRoutingModule RouteCollection 中查找 Request 匹配的 RouteHandler, 默认是 MvcRouteHandler MvcRouteHandler 创建 MvcHandler 实例 .  MvcHandler 执行 ProcessRequest.  MvcHandler 使用 IControllerFactory 获得实现了 IController 接口的实例 , 找到对应的 HomeController   根据 Request 触发 HomeController Index 方法 Index 将执行结果存放在 ViewData HomeController Index 方法返回 ActionResult Views/Home/Index.aspx ViewData 呈现在页面上 Index.aspx 执行 ProcessRequest 方法 Index.aspx 执行 Render 方法 输出到客户端

转载于:https://www.cnblogs.com/huijie/p/3738817.html

最新回复(0)