Aspnet mvc移除WebFormViewEngine

为了提高mvc的速度,在Global.asax中移除WebFormViewEngine

        protected void Application_Start()
        {
            RemoveWebFormEngines();
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

        void RemoveWebFormEngines()
        {
            var viewEngines = ViewEngines.Engines;
            var webFormEngines = viewEngines.OfType<WebFormViewEngine>().FirstOrDefault();
            if (webFormEngines != null)
            {
                viewEngines.Remove(webFormEngines);
            }
        }

 

posted @ 2019-04-17 10:05 _York 阅读(...) 评论(...) 编辑 收藏