Multiple Site Bindings

A WCF application in IIS is a service page that is hosted under a site. You can assign different bindings to the site that describe the protocols through which the site can communicate. It’s possible to assign multiple protocols to a single site by specifying bindings that have different protocol schemes. It’s also possible to assign multiple addresses for a single protocol to a single site by specifying bindings that have the same protocol scheme.

WCF has supported services hosted in IIS that have multiple protocols but not services that have multiple addresses for a single protocol. A service with multiple base addresses for a single protocol scheme would fail to start running when activated. You could partially work around this limitation by supplying base address prefix filters. A prefix filter allows you to pick one base address to use with your service for each protocol scheme.

 <serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix=”www.example.com:80”/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>

After filtering, other pages in the site could use any of the addresses while still allowing the WCF service to run. However, the WCF service would only be listening on the portion of addresses that start with the path defined by the filter.

In 4.0 you can enable support for multiple bindings with IIS without having to pick a single base address.

 <serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />

This feature for using multiple bindings with IIS is limited to HTTP protocol schemes though.