WCF Multiple host headers IIS7 in a DMZ with NAT


After some investigations I have come to the following conclusion. You can not host a WCF service in IIS7, .NET 3.5, where the host site uses multiple host headers and have the service respond to more than one of those host headers.


IIS is in a DMZ with one internal IP address. It can also be accessed from the internet via a public different IP address that goes through Network Address Translation at the firewall. Thus effectively the site has one IP address but two possible host headers to respond to.


In order to get the WSDL to correctly insert the IP address of the server, rather than the server machine name. Two entries were made into the site bindings, with separate host headers (IP address as host header as we have no domain name set up for this server) for each.

This creates an error from the service that you will find many reference to by searching the Internet.

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

This is because WCF only supports one base address for each protocol, but IIS can support multiple. This is summarised nicely here: Ram Poornalingam's WebLog

If you don’t configure up both IIS bindings in the WCF configuration you get the following message as WCF does not know what to do.

No protocol binding matches the given address [blah blah blah] Protocol bindings are configured at the Site level in IIS or WAS configuration


I set the host header as the IP address of the site as the WSDL was reporting localhost as the address of the server without it.