我有一个站点可以在我的本地 IIS 上完美运行。
我的所有页面都使用默认的共享局部 View ,称为预期的 _Layout.cshtml
。此 View 放在我的共享文件夹中。这可以在这里看到:
正如我所料,这非常有效。
但是,我现在发布我的网站。然后,我的一些页面在 HomeController
之外,结果是:
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
这当然是真的,但我希望它在我的共享文件夹中搜索 _Layout.cshtml
,而不是这些文件名。
我能做些什么来解决它?为什么它适用于我的本地 IIS,而不适用于生产环境?
最佳答案
事实证明问题完全出在其他地方。
事实证明,许多旧 View 已将“内置操作”设置为“无”。这导致我的视图不存在,然后它根本找不到它们。
这个错误是有道理的,但我没有看到这是真正的问题!
关于asp.net - 将 MVC 站点部署到 IIS 会导致它找不到默认的共享局部 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25920595/