Reputation: 9966
I have a site that works perfectly on my local IIS.
All my pages uses a default shared partial view, which is called the expected _Layout.cshtml
. This view is placed in my Shared folder. This can be seen here:
This works perfectly, as I would expect.
However, I now publish my website. Then, some of my pages outside the HomeController
, results in a :
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Search/Index.aspx
~/Views/Search/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Search/Index.cshtml
~/Views/Search/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
This is of course true, but I would expect it to search for _Layout.cshtml
in my shared folder, and not these file names.
What can I do to solve it? And why does it work on my local IIS, and not on production?
Upvotes: 2
Views: 973
Reputation: 9966
It turns out there problem was somewhere else entirely.
It turned out many of the old views had set "Built action" to "None". That resulted in my views not existing, and then it simply could not find them.
The error makes sense, but I had not seen that this was the actual problem!
Upvotes: 6