System.Web.HttpException (0x80004005): The file '/Views/Shared/_Layou.cshtml' has not been pre-compiled, and cannot be requested.

  • Thread starter Thread starter sofaki_10
  • Start date Start date
S

sofaki_10

Guest
Hello,

I have a MVC site (mvc 5.2.3.0 version) installed on a Windows Server 2012 standard, that is working properly for over a year. The last 2 months I have faced repeatedly the following issue.

I have deployed changes and the site is working perfectly. I should mention that I publish the site pre-compiled. Also the application pool is set to "Always running", so that there is no loading time. After a week (5-7 days) it crushes without having changed (I have validated that there is nothing changed) with the following error:

System.Web.HttpException (0x80004005): The file '/Views/Shared/_Layout.cshtml' has not been pre-compiled, and cannot be requested.
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.WebPages.BuildManagerWrapper.ExistsInPrecompiledSite(String virtualPath)
at System.Web.WebPages.VirtualPathFactoryManager.Exists(String virtualPath)
at System.Web.WebPages.WebPageExecutingBase.NormalizeLayoutPagePath(String layoutPagePath)
at System.Web.WebPages.StartPage.set_Layout(String value)
at System.Web.WebPages.StartPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)



I have tried several things to restore it, but nothing is working, change the user to the application pool, restart the machine, IIS and it is major that the site should not crush. So the only way I have found to recover is to rebuild it and redeploy it, the same source code, the dlls are the same, nothing is missing or corrupted.

I suspect after searching for this, that there is a problem with my mvc dll version. I read that nuget packages might come with updates and that might not always load from the site's folder, so that could make an issue if the downloaded version does not apply to mvc dll in my folder. Could that be the case and if so how can I solve it? (I ask here because all the errors I find is during deploy but in my case deploy solves my problem so I am kind of stuck an how can I solve this?)

Continue reading...
 
Back
Top