IIS has web sites, which are containers for virtual applications which contain virtual directories. The application in a site can be accessed through one or more IIS binding.
IIS bindings provide two pieces of information – binding protocol and binding information. Binding protocol defines the scheme over which communication occurs, and binding information is the information used to access the site.
Binding protocol – HTTP
Binding Information – IPAddress , Port, Hostheader
IIS supports specifying multiple IIS bindings per site, which results in multiple base addresses per scheme. A WCF service hosted under a site allows binding to only one baseAddress per scheme.
Solution in .Net Fx 3.0:Supporting Multiple IIS Bindings Per Site
Solution in .Net Fx3.5: BaseAddressPrefixFilters
I am updating this blog entry with a better solution support for 3.5. This one does not require you to write custom factories
Step1 set the baseAddressPrefix to one of the addresses
Step 2 Set the endpoints in your web.config file to be absolute URIs
<endpoint address=”http://payroll.myorg.com:9000/Service1.svc/EP12″ Binding=”…” Contract=”…” />
Solution in .Net Fx4.0: BaseAddressPrefixFilters
In the current Beta2 release of the .NET Framework, we added support for multiple site binding . Just set the binding in IIS site and the service will inherit the address
Final RTM Fix
In the final bits, we decided to make it an opt-in due to application compatability reasons. In order to enable multiple site binding, you need to set multipleSiteBindingEnabled to true in your application. Multiple site binding is supported only for Http protocol. The address of endpoints in the configuration file need to be complete URI. When porting your 3.0 or 3.5 workaround to 4.0 you need to keep this particular aspect.
<serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />