tags:

views:

19

answers:

2

I get this intermittent WCF error:

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

I tried various solutions by from googling around and from stackoverflow and they work for a while until the error shows up again and then I attempt another solution. It is really frustrating. Right now this is all voodoo to me as I don't understand why this is happening. It appears that if I touch the webconfig file and save it, the error disappears. I don't know if this causes it, but my webconfig is nested in that it lives under a special webservices folder. Any suggestions?

A: 

If you have more than one http base endpoints (i.e. WsHttpBinding and BasicHttpBinding) and trying to add them at the same time, you will get this error.

Mohammadreza
I'm only using WsHttpBinding
Joel Rodgers
Do you have two http addresses then? If so try to host them separately and not in a same Uri[].
Mohammadreza
Thanks Mohammadreza. Looks like this is what I have to do. I do have the a subfolder called webservices that contains a separate web.config. It contains all the WCF settings.
Joel Rodgers
A: 

Take a look at how your IIS bindings are defined/configured in the IIS .config file located at...

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

Find your way to the Sites-Site-Bindings section, then look for bindings that have the same protocol defined. Example:

<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:*" />

Notice there are two bindings for the "net.tcp" protocol. The above example configuration will throw the following error:

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

I personally experienced this error when I added the net.tcp protocol using the command prompt (as opposed to IIS Manager):

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

Jed