Asp.Net MVC技术之删除无用的视图引擎
在Global.asax中添加如下代码:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 void RemoveWebFormEngines() 2 { 3 var viewEngines = ViewEngines.Engines; 4 var webFormEngines = viewEngines.OfType<WebFormViewEngine>().FirstOrDefault(); 5 if (webFormEngines != null) 6 { 7 viewEngines.Remove(webFormEngines); 8 } 9 } 10 11 protected void Application_Start() 12 { 13 RemoveWebFormEngines(); //移除WebForm视图引擎 14 AreaRegistration.RegisterAllAreas(); 15 16 WebApiConfig.Register(GlobalConfiguration.Configuration); 17 FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 18 RouteConfig.RegisterRoutes(RouteTable.Routes); 19 BundleConfig.RegisterBundles(BundleTable.Bundles); 20 AuthConfig.RegisterAuth(); 21 }