2010-04-15 67 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>