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

asp.net-mvc – 运行时错误没有为扩展名’.cshtml’注册的构建提

发布时间:2020-12-16 00:36:53 所属栏目:asp.Net 来源:网络整理
导读:当我尝试在mvc 4中运行我的脚手架视图时,我收到以下错误: Server Error in ‘/’ Application. There is no build provider registered for the extension ‘.cshtml’. You can register one in the section in machine.config or web.config. Make sure
当我尝试在mvc 4中运行我的脚手架视图时,我收到以下错误:

Server Error in ‘/’ Application.
There is no build provider registered for the extension ‘.cshtml’. You can register one in the section in
machine.config or web.config. Make sure is has a
BuildProviderAppliesToAttribute attribute which includes the value
‘Web’ or ‘All’.

我发现唯一的答案与智能感知有关,但我的代码在运行时符合罚款。这是一个奇怪的错误,因为我没有使用类库。只有一个控制器可以对其所有视图发送此消息,所有其他控制器/视图都可以正常工作。

解决方法

这解决了我的问题。

在Web.config中进行更改

<compilation debug="true" targetFramework="4.5.1" optimizeCompilations="true" />

<compilation debug="true" targetFramework="4.5.1" optimizeCompilations="false" />

ADDED:几分钟后我将web.config恢复为旧,问题不重复。奇怪的东西 )

(编辑:李大同)

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

    推荐文章
      热点阅读