There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute
which includes the value 'Web' or 'All'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> 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.0">
<assemblies>
<add assembly="System.Web.WebPages.Razor, Version=1.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
</assemblies>
<buildProviders>
<add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</buildProviders>
</compilation>
本文介绍了解决.cshtml文件在.NET应用中无法被正确编译的问题,提供了详细的web.config配置示例来注册正确的Build Provider。

1288

被折叠的 条评论
为什么被折叠?



