Today, I was trying to setup a simple WCF service on my hosting service smarterasp.net (they are superb! I’ve been using them for about two weeks and it has been a breeze to setup websites and applications using their control panel. I came across them through a thread about hosting options for ASP.NET on Quora)
So, while setting up the service with basic HTTP binding, everything ran fine on my dev machine (it always does right?!) but when I deployed to the hosting site using VS Deploy, I ran into a YSOD (yellow screen of death for the uninitiated) that complained
“This collection already contains an address with scheme http”.
To be fair, the error screen described the fix as well, but to be a 100% sure, I looked up the error and found this stackoverflow thread:
I followed the configuration based solution described in the accepted answer and was able to get the service running absolutely fine.
In summary, I added this in the Web.config:
<system.serviceModel> <serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix="http://mydomain"/> </baseAddressPrefixFilters> </serviceHostingEnvironment> </system.serviceModel> Hope this helps. Happy Coding!