2010-07-02 23 views
2

我得到这个间歇WCF错误地址:间歇WCF错误:集合已经包含方案http

此集合已经包含方案http的地址。此集合中每个方案最多可以有一个地址。 参数名称:项目

我尝试了各种解决方案,从谷歌搜索和从stackoverflow和他们工作了一段时间,直到错误再次显示,然后我尝试另一种解决方案。这真的令人沮丧。现在,这对我来说都是伏都教,因为我不明白为什么会发生这种情况。看来,如果我触摸webconfig文件并保存它,错误消失。我不知道这是否会导致它,但我的webconfig是嵌套的,它住在一个特殊的web服务文件夹下。有什么建议么?

+0

哪些你的system.servicemodel配置组的内容? – 2010-07-02 00:52:29

回答

0

如果您有多个http基础端点(即WsHttpBinding和BasicHttpBinding)并尝试同时添加它们,则会出现此错误。

+0

我只使用WsHttpBinding – 2010-07-03 04:20:03

+0

你有两个http地址吗?如果是这样,尝试分别托管他们,而不是在同一个Uri []中。 – mrtaikandi 2010-07-03 06:17:43

+0

谢谢Mohammadreza。看起来这是我必须做的。我确实有一个名为webservices的子文件夹,其中包含一个单独的web.config。它包含所有的WCF设置。 – 2010-07-03 14:42:53

2

看看你的IIS绑定是如何定义/在位于IIS config文件配置...

C:\Windows\System32\inetsrv\config\applicationHost.config

找到通往站点,站点绑定部分,然后查找绑定具有相同的协议定义。例如:

<binding protocol="http" bindingInformation="*:80:" /> 
<binding protocol="net.tcp" bindingInformation="8081:*" /> 
<binding protocol="net.pipe" bindingInformation="*" /> 
<binding protocol="net.msmq" bindingInformation="localhost" /> 
<binding protocol="msmq.formatname" bindingInformation="localhost" /> 
<binding protocol="https" bindingInformation="*:443:" /> 
<binding protocol="net.tcp" bindingInformation="9000:*" /> 

注意“net.tcp”协议有两个绑定。上面的例子中的配置将抛出以下错误:

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

我亲身经历这个错误,当我使用命令提示(相对于IIS经理)加入的net.tcp协议:

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol-'net.tcp',bindinginformation-'9000:*']