asp.net - 将 MVC 站点部署到 IIS 会导致它找不到默认的共享局部 View

标签 asp.net asp.net-mvc asp.net-mvc-4 iis

我有一个站点可以在我的本地 IIS 上完美运行。

我的所有页面都使用默认的共享局部 View ,称为预期的 _Layout.cshtml。此 View 放在我的共享文件夹中。这可以在这里看到:

enter image description here

正如我所料,这非常有效。

但是,我现在发布我的网站。然后,我的一些页面在 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/

相关文章:

asp.net - 将 Container.Eval 传递给 ASP.NET Repeater Control 内的 (Html.ReaderPartial)

javascript - 使用 javascript 清除 asp.net 文本框不起作用

javascript - 托管后 Google map 未在 Angular View 中呈现

asp.net-mvc - jquery ui css 不加载和创建 asp.net mvc3 页面问题(意外 token 错误)

javascript - 如何向ajax传递多个值?

c#-4.0 - C# 中的后台任务

c# - 无法查看我使用 json 返回的查询结果

c# - 如何找到最后一次执行循环 while(dr.Read())?

asp.net - AJAX 和 asp.net 安全问题

asp.net-mvc - Elmah 基本设置问题/问题