Reputation:
I have a MVC5 website running under IIS on a Windows 2008 R2 server. The website works fine for a few hours and then I start seeing error messages saying
The layout page "~/Views/Shared/Master.cshtml"
could not be found at the following path:
"~/Views/Shared/Master.cshtml".
The error goes away if I restart the website which is not optimal. Any idea on what may be going on here? The website does use async controllers and could that be causing some sort of permission issues where the thread does not have access to the file?
Upvotes: 0
Views: 1606
Reputation: 5474
Make sure that in your ~/Views/_ViewStart.cshtml
file you have set the correct path:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
You seem to have set the Layout like this:
@{
ViewBag.Title = "title";
Layout = "_Layout";
}
You need to specify the location to the layout as absolute path:
@{
ViewBag.Title = "title";
Layout = "~/Views/Shared/_Layout.cshtml";
}
Upvotes: 1