This error bugged for me a while before I found out not one but two solutions.
I prefer the first approach because I use baseAddresses[0] in the Custom Host Factory and that it doesn't require me to have two web.config files as in the 2nd approach.
# posted by Zubair.NET! @ 3:33 PM