Tutorial :WCF webservice running on a two server cluster, with loadbalancer, resolving web service address


Apologies for the long winded title but looking for a solution to what might be a common problem.

We have a loadbalancer with address, say: www.myloadbalancer.com

Below are two web servers

First server: webserver1.farm.com
Second server: webserver2.farm.com

We deployed a webservice on to the two servers but noticed something funny when trying to consume the web services somewhere else.

We deploy to:

  • webserver1.farm.com/service1.svc and
  • webserver2.farm.com/service1.svc

Because the web servers are not directly accessible online you have to go through the load balancer.

So the address to consume is www.myloadbalancer.com/service1.svc.

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 webserver1.farm.com/service1.svc not www.myloadbalancer.com/service1.svc.

If you attempt to consume www.myloadbalancer.com/service1.svc, say in Visual Studio 2008, you get a warning that webserver1.farm.com/service1.svc does not exist.

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 www.myloadbalancer.com/service1.svc regardless of whether we end up on web server 1 or 2?


A WSDL file is a WSDL file. Edit it to point to the correct URL. (You don't have to use the auto-generated http://webserver1.farm.com/service1.svc?WSDL if you don't want to.)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »