WCF配置元素:baseAddressPrefixFilters

Dar*_*uck 6 wcf configuration-files

我已经阅读了该元素的文档,但仍然无法理解其目的是什么.以下是我在示例中看到它的示例:

<serviceHostingEnvironment>
  <baseAddressPrefixFilters>
    <add prefix="http://localhost:5100/"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>
Run Code Online (Sandbox Code Playgroud)

我想了解服务节点中的基地址不起作用.我不明白这个元素实际上用于什么.

Mau*_*ice 9

WCF服务主机仅允许每个方案使用单个基址(在本例中为HTTP).现在,如果在配置了多个基地址的IIS上部署WCF服务,例如http://www.example.comhttp://example.com,您将看到错误.使用baseAddressPrefixFilters,您可以过滤两个基地址之一,您的服务将运行正常.