Multiple bindings issue with WCF service

We recently implemented a WCF service in a web application designed for multi tenancy, and when testing outside of the web development server in IIS got a ‘yellow screen of death’ with:

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

In the test IIS platform we had multiple bindings defined to support our multi tenancy approach using sub domain to divide the tenants. These bindings were being presented to the constructor of the ServiceHost implementation (I know its too much info, but we were using an implementation of ServiceHostFactory to create an IoC container aware host, and the only reason i mention is that it made debug of this issue really straight forward) as multiple baseAddresses.

The resolution was fortunately incredibly straight forward, the service model config has a mechanism to filter base addresses by prefix. So it was just a case of configuring an appropriate prefix in the baseAddressPrefixFilters.

Comments are closed