WCF web service running on a two server cluster, with a balancer, resolving the web service address

Sorry for the long title, but looking for a solution to what might be a common problem.

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

Below are two web servers

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

We deployed a web service on two servers, but noticed something funny when we tried to use web services elsewhere.

We are deploying:

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

Since web servers are not directly accessible on the Internet, you need to go through a load balancer.

So the address for consumption is www.myloadbalancer.com/service1.svc .

However, we find that if the loadbalancer directs you to server 1 and you check the WSDL, you see the service name and data as webserver1.farm.com/service1.svc not www.myloadbalancer.com/service1.svc .

If you try 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 assign an alias to a web service. in other words, is it possible to make a service describe itself as www.myloadbalancer.com/service1.svc regardless of whether we end up on web server 1 or 2?

+4
source share
1 answer

A WSDL file is a WSDL file. Edit it to provide the correct URL. (You do not need to use the automatically generated http://webserver1.farm.com/service1.svc?WSDL if you do not want to.)

+4
source

All Articles