[IIS 8.5中浏览.svc文件时出现404.7错误

问题描述 投票:0回答:2

[我在IIS 8.5中浏览.svc文件时收到404.7错误(错误消息:找不到,请求过滤模块配置为拒绝文件扩展名)

我可以通过在web.config文件中添加以下代码来解决它:

<system.webServer>
    <security>
      <requestFiltering>
        <fileExtensions allowUnlisted="true">
          <remove fileExtension="." />
             <add fileExtension="." allowed="true" />
        </fileExtensions>
      </requestFiltering>
    </security>
  </system.webServer>

但是我无法弄清楚为什么会首先引发此错误。

我已经验证:

1)请求过滤已打开2).svc文件不在拒绝的扩展名列表中3)在IIS中选中“允许未列出的文件扩展名”。

使用这些设置,是否不必在web.config文件中添加以上代码的情况下浏览.svc文件?我还想念什么?

windows wcf iis iis-8.5 requestfiltering
2个回答
0
投票

要解决此问题,您可以尝试以下解决方法:

1)进入IIS->单击“网站/应用程序”->选择“请求过滤”->单击“允许文件扩展名”->添加“ .svc”->确定

2)将belw代码添加到您的web.confgig文件中:

<handlers>
   <add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>

https://stackoverflow.com/a/12519582


0
投票

只是一个补充,为了支持IIS中的WCF扩展,我们应该启用以下Windows功能。

  1. 转到控制面板
  2. 打开或关闭Windows功能。
    enter image description here
    请随时告诉我是否有什么我可以帮助的。
© www.soinside.com 2019 - 2024. All rights reserved.