加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-3 – 部署到“真实”IIs网站时默认Razor View的问题

发布时间:2020-12-16 09:45:23 所属栏目:asp.Net 来源:网络整理
导读:我有这个ASP.NET MVC 3应用程序,使用IIs Express 7.5或Cassini在本地开发时工作正常. 但是当我将应用程序部署到IIs 7.5上的真实网站时(甚至在我当地的开发盒上),我感到很害怕 The view ‘Index’ or its master was not found or no view engine supports th
我有这个ASP.NET MVC 3应用程序,使用IIs Express 7.5或Cassini在本地开发时工作正常.
但是当我将应用程序部署到IIs 7.5上的真实网站时(甚至在我当地的开发盒上),我感到很害怕

The view ‘Index’ or its master was not found or no view engine supports
the searched locations.
The following
locations were searched:
~/Views/Home/Index.cshtml
~/Views/Home/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml

我尝试过以下方法:
在global.asax.cs中,在Application_Start()方法中添加了这些行以强制它仅使用Razor视图引擎:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());

但无济于事.
我发现此错误消息有些难以排除故障.有人可以给我一些关于寻找什么的指示吗?

解决方法

好的,我的坏.

先拍摄的典型例子然后问. (或者相反……)

由于某种原因,Home / Index.cshtml文件的Build Actions设置为None.将其设置为内容解决了问题.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读