Tuesday, September 7, 2010

Configuring WCF for Multi Addresses

If you have a web site that has two address, for example: http://IP:PORT/ and http://www.YourSiteHere.com, and if you have a WCF that you need it to work in both URLs, then the configuration of the WCF will be different in that case. To achieve that add the following elements under system.ServiceModel

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
<baseAddressPrefixFilters>
<add prefix="http://www.YourSiteHere.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>