I have an environment where multiple sites hosted on the same server will use a single service to make its calls. For example:
http://domain1.com/Api/Service.svc
http://domain2.com/Api/Service.svc
The Api application has been setup as a virtual directory in each site mapped to the same physical directory, so that the source is only located in one place. The problem is that WCF doesn't like having multiple base addresses for its service endpoints. To get the service to work at all, I had to add a base address prefix filter:
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://domain1.com/Api" />
<!--<add prefix="http://domain2.com/Api" />-->
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
However this only works for domain1, because you're only allowed one baseAddressPrefixFilter (they shouldn't call it baseAddressPrefixFilter**s** if you're only allowed one). I tried building a custom ServiceHostFactory to get around it, but I run into the filter problem before the ServiceHostFactory is called in the Activation process.
Any ideas on how to get a single service to work on 2 domains like this?