protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //调用容器的创建 var container = BlogContainer.GetContainer(); //解析器的替换 //DependencyResolver.SetResolver(new BlogDependencyResolver(container)); //直接跳过IControllerActivator直接从容器创建 ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container)); }