title: How can you load balance an IIS 6 hosted WCF Service?
body: <p>We use BigIP to load balance between our two IIS servers.  We recently deployed a WCF service hosted on by IIS 6 onto these two Windows Server 2003R2 servers.</p>
  
  <p>Each server is configured with two host headers:  one for the load balancer address, and then a second host header that points only to that server.  That way we can reference a specific server in the load balanced group for debugging.</p>
  
  <p>So when we run We immediately got the error:</p>
  
  <blockquote>
    <p><strong>This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. 
    Parameter name: item</strong></p>
  </blockquote>
  
  <p>I did some research and we can implement a filter to tell it to ignore the one of the hosts, but then we cannot access the server from that address.    </p>
  
  <pre><code>&lt;serviceHostingEnvironment&gt;
      &lt;baseAddressPrefixFilters&gt;
          &lt;add prefix="http://domain.com:80"/&gt;
      &lt;/baseAddressPrefixFilters&gt;
  &lt;/serviceHostingEnvironment&gt;
  </code></pre>
  
  <p>What is the best solution in this scenario which would allow us to hit a WCF service via <a href="http://domain.com/service.svc" rel="nofollow noreferrer">http://domain.com/service.svc</a> and <a href="http://server1.domain.com/service.svc" rel="nofollow noreferrer">http://server1.domain.com/service.svc</a>?</p>
  
  <p>If we should create our own ServiceFactory as some sites suggest, does anyone have any sample code on this?</p>
  
  <p>Any help is much appreciated.</p>
  
  <p>EDIT: We will need to be able to access the WCF service from either of the two addresses, if at all possible.</p>
  
  <p>Thank you.</p>