ASP.NET Razor网站:“www;“不提供此类页面”;

ASP.NET Razor网站:“www;“不提供此类页面”;,razor,asp.net-webpages,Razor,Asp.net Webpages,我创建了一个空的ASP.NET网站(即razor网页),但无法访问index.cshtml页面 无论URL中是否有“index.cshtml”,这都是正确的 错误页面显示: “/”应用程序中出现服务器错误 不提供这种类型的页面 说明:您请求的页面类型未被提供,因为 它已被明确禁止。扩展名“.cshtml”可能是 不对。请查看下面的URL并确保它是正确的 拼写正确 请求的URL:/index.cshtml 下面是web.config的全部内容 <?xml version="1.0"?>

我创建了一个空的ASP.NET网站(即razor网页),但无法访问
index.cshtml
页面

无论URL中是否有“index.cshtml”,这都是正确的

错误页面显示:

“/”应用程序中出现服务器错误

不提供这种类型的页面

说明:您请求的页面类型未被提供,因为 它已被明确禁止。扩展名“.cshtml”可能是 不对。请查看下面的URL并确保它是正确的 拼写正确

请求的URL:/index.cshtml

下面是web.config的全部内容

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="webpages:Enabled" value="true"/>
    <add key="webpages:Version" value="3.0.0.0"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5" enableVersionHeader="false" requestValidationMode="2.0"/>
    <pages validateRequest="false"/>
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering allowDoubleEscaping="true">
        <fileExtensions>
          <remove fileExtension=".cshtml"/>
          <add fileExtension=".cshtml" allowed="true"/>
        </fileExtensions>
      </requestFiltering>
    </security>
    <defaultDocument>
      <files>
        <remove value="index.cshtml"/>
        <add value="index.cshtml"/>
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>


有人能告诉我我缺少了什么(或者我添加了什么,哪些不应该存在)?

在app_start文件夹中的routeconfig.cs文件中进行设置。没有app_start文件夹。请确保IIS中的app pool设置为.NET 4集成管道。我使用的是Cassini-我只需点击F5就得到了错误。