The layout page “{path}” could not be found

白昼怎懂夜的黑 提交于 2019-11-27 22:52:34

It seems like you probably have a permissions issue. With the info you've given, it seems like the most likely cause of not being able to find the _Layout.cshtml file.

With Server 2008 and IIS 7, application pool's have their own identity used for ACL's (named IIS AppPool{App Pool Name}), and these identities are made part of the IIS_IUSRS group. Also, your default inetpub/wwwroot directory will have read permissions for the IIS_ISRS group. So, if your not getting the permissions you need, I would think that the App pool is not in fact running with the correct identity.

One reason the identity may be incorrect is the setting for Anonymous Authentication user identity. Go into the Authentication control for the site (or the whole server) and edit the Anonymous Authentication rule to run as the Application Pool Identity.

This is a bit of a guess, but it seemed this fellow had nearly the exact same issue.

As qbantek found, for me this was related to the _layout.cshtml file build action being set to none.

the reason it was set to none is that I started with an empty mvc project template and manually added the _layout.cshtml file to the project.

so lesson learned, when you start with an empty project template, and you add the layout file manually, you have to set the build action manually as well.

This problem can be about security permission sometimes. You make sure have permission to read/write in folder/file.

My problem was the .suo file contained Old filepaths. I closed VS, deleted my suo file, re-opened VS, and it works fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!