If you have create a simple WCF service “HelloWorld.svc” and you load it up inside your Visual Studio, you get a result like this if metadata publishing is enabled.
The host name “mycomputer.private.mydomain.com” is automatically picked up by WCF. Of course if this service is hosted on a public server, you don’t want to expose the server name to the consumers of your service. In the real production environment, you would want to use a public host name or even an IP address in the address.
Therefore open up the IIS manager, select the website of your choice and click on the Bindings link in the Actions part.
In the window that shows up add the hostname you want to use(for example www.microsoft.com). The first time I did this I got following exception:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
This error was caused by the fact that I now had 2 addresses pointing to the same scheme. Therefore instead of adding a second hostname, change the hostname on the existing http scheme. This should do the trick…