title: Multiple Base Addresses in single WCF Service
body: <p>I have an environment where multiple sites hosted on the same server will use a single service to make its calls.  For example:</p>
  
  <p><a href="http://domain1.com/Api/Service.svc" rel="noreferrer">http://domain1.com/Api/Service.svc</a></p>
  
  <p><a href="http://domain2.com/Api/Service.svc" rel="noreferrer">http://domain2.com/Api/Service.svc</a></p>
  
  <p>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:</p>
  
  <pre><code>&lt;serviceHostingEnvironment&gt;      
    &lt;baseAddressPrefixFilters&gt;        
      &lt;add prefix="http://domain1.com/Api" /&gt;
      &lt;!--&lt;add prefix="http://domain2.com/Api" /&gt;--&gt;
    &lt;/baseAddressPrefixFilters&gt;
  &lt;/serviceHostingEnvironment&gt;
  </code></pre>
  
  <p>However this only works for domain1, because you're only allowed one baseAddressPrefixFilter (they shouldn't call it baseAddressPrefixFilter<strong>s</strong> 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.  </p>
  
  <p>Any ideas on how to get a single service to work on 2 domains like this?</p>