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.

<add prefix=”>

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.

Comments (4)

  1. JohnW says:

    Nick, would this mean that in .NET 4, I could have a WCF service listening on http://site:80 using both basic & integrated authentication, and clients would negotiate the authentication type as required?

  2. Hi John,

    To support multiple protocol configurations you would need two endpoints set up at different addresses to do that.  With this feature you could now have the two endpoint base addresses without requiring them to share a single common prefix.

  3. Dmitriy Sosunov says:

    Nick, it seems that no often used scenario.

    Could you give a real-world scenario where this feature could be useful.


  4. Hi Dmitry,

    Having the same service be accessible from two different domain names is a popular one.