title: WCF webservice running on a two server cluster, with loadbalancer, resolving web service address
body: <p>Apologies for the long winded title but looking for a solution to what might be a common problem.</p>
  
  <p>We have a loadbalancer with address, say:  <code>www.myloadbalancer.com</code></p>
  
  <p>Below are two web servers</p>
  
  <p>First server: <code>webserver1.farm.com</code><br>
  Second server: <code>webserver2.farm.com</code></p>
  
  <p>We deployed a webservice on to the two servers but noticed something funny when trying to consume the web services somewhere else. </p>
  
  <p>We deploy to:</p>
  
  <ul>
  <li><code>webserver1.farm.com/service1.svc</code> and </li>
  <li><code>webserver2.farm.com/service1.svc</code></li>
  </ul>
  
  <p>Because the web servers are not directly accessible online you have to go through the load balancer.</p>
  
  <p>So the address to consume is <code>www.myloadbalancer.com/service1.svc</code>.</p>
  
  <p>However what we are finding is that if the loadbalancer directs you to server 1, and you check the WSDL, you see the service name and details as <code>webserver1.farm.com/service1.svc</code> not <code>www.myloadbalancer.com/service1.svc</code>.</p>
  
  <p>If you attempt to consume <code>www.myloadbalancer.com/service1.svc</code>, say in Visual Studio 2008, you get a warning that <code>webserver1.farm.com/service1.svc</code> does not exist.</p>
  
  <p>The main question is, is it possible to give an alias name to a webservice.
  in other words is it possible to get the service to describe itself as  <code>www.myloadbalancer.com/service1.svc</code> regardless of whether we end up on web server 1 or 2?</p>