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.
I was porting some code from a prototype project into the production solution, and frankly it wasn’t going well! Debugging the Silverlight aspect I was seeing an AG_E_PARSER_BAD_TYPE error thrown when one of my view models was being loaded.
I knew it was something I had missed – at least that was something.
I was using Prism formerly the Composite Application Guidanceso the issue was caused when loading from my sub module.
To cut a long (well an hour at least) story short, you need to ensure that any references used by the module are also available to the shell. In my case I was referencing controls toolkit in the module, but hadn’t made sure this was referenced in the shell.
One to remember…