2010-04-15 72 views
2

我无法让我的WCF服务使用多个http绑定。WCF 3.5服务和多个http绑定

在IIS 7我要绑定的http:/服务和http:/service.test无论是在 端口80

在我web.config我已经添加了baseAddressPrefixFilters,但我不能添加超过一个 更多

<serviceHostingEnvironment> 
    <baseAddressPrefixFilters> 
     <add prefix="http://service"/> 
     <add prefix="http://service.test"/> 
    </baseAddressPrefixFilters> 
</serviceHostingEnvironment> 

这给了几乎同样的错误

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.

仿佛都没有指定文件管理器(这个集合已经包含一个 地址与方案http。此集合中的每个方案最多可以有一个地址 。 参数名称:项目)

如果我只添加一个过滤器,那么该服务将工作,但仅对 添加的过滤器地址做出响应。

我也试图与specifing像多个端点(且只有一个过滤器):

<endpoint address="http://service.test" binding="basicHttpBinding" bindingConfiguration="" contract="IService" /> 
<endpoint address="http://service" binding="basicHttpBinding" bindingConfiguration="" contract="IService" /> 

还仅仅在过滤器的工作原理及其他 回报也指定了该错误的地址:

Server Error in Application "ISPSERVICE" HTTP Error 400.0 - Bad Request

问候 莫滕

回答

0

我试图WCF服务部署到我的web服务器的行吟诗人之一天,并遇到了问题。我一直得到以下错误信息:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.Parameter name: item

的问题并没有我的本地机器上发生,但使得它有点难以弄清楚是什么导致它没有在Web服务器上。它发生在服务器上,因为我的Web服务器在共享主机环境中,在这种情况下,WCF服务也需要知道主机头。为此,我导航到<system.serviceModel> web.config并添加以下内容:

<serviceHostingEnvironment> 
<baseAddressPrefixFilters>  
    <add prefix=http://MyHostHeader /> 
</baseAddressPrefixFilters> 
</serviceHostingEnvironment>