经过一段时间(确切的时间未确定),我们的MVC应用程序开始出错,错误消息和堆栈跟踪如下。
我们没有注册任何自定义ViewEngines ...触摸web.config文件会清除此错误一段时间。
我能错过什么?
[InvalidOperationException: The property 'MasterLocationFormats' cannot be null or empty.]
System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations) +697
System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache) +288
System.Web.Mvc.<>c__DisplayClass6.<FindView>b__4(IViewEngine e) +43
System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator) +96
System.Web.Mvc.ViewResult.FindView(ControllerContext context) +144
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +153
System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +709
System.Web.Mvc.Controller.ExecuteCore() +162
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +58
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
答案 0 :(得分:0)
一个想法可能是存储库实例正在被重用。确保为具有填充MasterLocationFormats
属性的方法的存储库创建新实例。