IIS Express (WebMatrix 2) won't serve .cshtml files in WebAPI project (VS10/WinXP)

走远了吗. 提交于 2019-12-08 18:33:24
Dave Swersky

SUCCESS!

The problem was a single line in the default WebAPI template web.config:

<appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />  <-- BAD!!!!
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

Setting that webpages:Enabled setting to true fixed the problem and now my .cshtml files work. Hope this helps others.

This question explains the webpages:Enabled setting: what is the function of webpages:Enabled in MVC 3 web.config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!