"This collection already contains an address with scheme http. There can be at most one address per scheme in this collection." is a Windows Communication Foundation (WCF) error message indicating you are trying to add an already existing binding. By default the web service listens to all in IIS configured host headers. A host header is the website address, for example example.com and www.example.com. If this is not correctly added to the web.config
file, the following error is thrown:
Server Error in MultipleBindings Application
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
With a correctly configured web.config
it's good possible to host the service on two URL's, for example https://payment.example.com:443 and https://payment.example.com:9000.
Fixes for "WCF Server Error in MultipleBindings Application" in differnet .NET Framework versions
Different .NET Framework versions have different solutions for this error.
Fix for .NET 2.0/3.0/3.5
- Set a baseAddressPrefix on one of the two URL's in the web.config file:
<system.serviceModel>
<servicehostingenvironment>
<baseaddressprefixfilters>
<add prefix="https://payment.example.com:443"/>
</baseaddressprefixfilters>
</servicehostingenvironment>
</system.serviceModel>
- Add both endpoint URL's as absolute URL's in the web.config file:
<services>
<service>
<endpoint
address="https://payment.example.com:443/Service1.svc/EP1"
Binding="..."
Contract="..." />
<endpoint address="https://payment.example.com:9000/Service1.svc/EP12"
Binding="..."
Contract="..." />
</service>
</services>
Fix for ASP.NET 4.0/4.5
ASP.NET 4.0/4.5 has a multipleSiteBindingsEnabled web.config configuration optie available to services multiple site bindings. Keep this in mind when you port your 3.0/3.5 application to 4.0.
<servicehostingenvironment multipleSiteBindingsEnabled="true" />
For ASP.NET 4.0/4.5 you first must install NET-HTTP-Activation and NET-WCF-HTTP-Activation features in IIS. Verify the *.svc
handler is added to IIS after installation.
References and more information:
- http://blogs.msdn.com/b/rampo/archive/2008/02/11/how-can-wcf-support-multiple-iis-binding-specified-per-site.aspx (Wayback Machine mirror)
- Supporting Multiple IIS Site Bindings
Thank you very much! <3 ❤️
Hi, my name is Jan. I am not a hacker, coder, developer or guru. I am merely an application manager / systems administrator, doing my daily thing at Embrace – The Human Cloud. In the past I worked at CLDIN (CLouDINfra) and Vevida. With over 20 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, websites & optimization. I blog at https://www.saotn.org.