Ensure that HttpConfiguration.EnsureInitialized() is called in the application's startup code after
老项目升级碰到的问题, .net mvc4.0 长为.net mvc 5.0碰到。
解决方案:
在Global.asax 文件里的Application_Start方法后面,加上
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ConfigJson(); GlobalConfiguration.Configuration.EnsureInitialized(); }