Multiple WCF services in the same IIS website

Tags: C# WCF

When working with WCF services, you might see this error when you have multiple WCF services in the same IIS website:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/ multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/ baseAddressPrefixFilters'.
Parameter name: item

This exception occurs when one website in IIS has multiple WCF services that both use the http or the https binding. It does not matter if the WCF services are virtual applications within the same IIS site. To remedy this, add the following XML to the web.config:

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    [ other configuration you added ]
</system.serviceModel>
Christiaan Verwijs
Christiaan Verwijs

Scrum Master, Trainer, Developer & founder of Agilistic