c# - MVC Azure无法找到具有默认路由的 View 或主控,但可以在本地工作

标签 c# html asp.net-mvc azure razor

我有一个在本地运行良好的 MVC 网站,但是当我将其部署到我的 Azure 网站时,除了主页索引页面之外的每个网页都会出现此错误。

The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Sales/Index.aspx
~/Views/Sales/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Sales/Index.cshtml
~/Views/Sales/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml

如有必要,我可以提供更多信息,但我无法在该问题的所有报告中找到遇到相同问题的人。大多数人确实将文件问题放在了错误的位置。但是,我的 Controller 和 View 结构很好,它们在本地工作。仅当部署到我的 Azure 网站时,它才无法找到 View 。

最佳答案

在每个 View 的属性中,我必须将“构建操作”更改为“内容”,并且发布实际上部署了 .cshtml 文件。

关于c# - MVC Azure无法找到具有默认路由的 View 或主控,但可以在本地工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29687452/

相关文章:

c# - 如何使用 Selenium c# 将剪贴板中的 url 粘贴到 Chrome 中的地址栏?

asp.net-mvc - 使用外部身份验证提供程序从 MVC5 框架 OAuth/OWin 身份提供程序获取 ExtraData

c# - 如何在谷歌标记 map 上使用 C# .net MVC 框架显示 Azure Cosmos DB 数据?

javascript - 我正在尝试使用 mvc JavaScript 函数启用/禁用下拉菜单

c# - 通过 .exe 文件名杀死一些进程

c# - 开发 SSIS 组件 : One source, 几个目标

c# - 包裹或不包裹

html - 删除正文和页脚 html 之间的奇怪空间

html - 负边距 : can they work in IE7 and IE8?

javascript - 从表中获取值