If you run WCF service in IIS under a web site with multiple host headers, you will get the following exception:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
From the documentation, Deploying an IIS-Hosted WCF Service:
Configure the WCF service
IIS-hosted WCF services store their configuration in the applications Web.config file. IIS-hosted services use the same configuration elements and syntax as WCF services hosted outside of IIS. However, the following constraints are unique to the IIS hosting environment:
- Base addresses for IIS-hosted services.
- Applications hosting WCF services outside of IIS can control the base address of the services they host by passing a set of base address URIs to the ServiceHost constructor or by providing a <host> element in the service’s configuration. Services hosted in IIS do not have the ability to control their base address; the base address of an IIS-hosted service is the address of its .svc file.
As you can see, the base address is determined automatically by the WCF library when you run your WCF service in IIS, but it fails to determine its base address when the hosting web site configured for multiple host headers:
If you remove the additional host headers from the host web site configuration, you won’t get such like exception again.