Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you load balance an IIS 6 hosted WCF Service?

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.

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.

So when we run We immediately got the error:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item

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.

<serviceHostingEnvironment>
    <baseAddressPrefixFilters>
        <add prefix="http://domain.com:80"/>
    </baseAddressPrefixFilters>
</serviceHostingEnvironment>

What is the best solution in this scenario which would allow us to hit a WCF service via http://domain.com/service.svc and http://server1.domain.com/service.svc?

If we should create our own ServiceFactory as some sites suggest, does anyone have any sample code on this?

Any help is much appreciated.

EDIT: We will need to be able to access the WCF service from either of the two addresses, if at all possible.

Thank you.

like image 975
Jason Stevenson Avatar asked Sep 23 '08 18:09

Jason Stevenson


1 Answers

On your bigIP Create 2 new virtual servers http://server1.domain.com/ http://server2.domain.com/

create a pool for each VS with only the specific server in it - so there will be no actual load balancing and access it that way. If you are short on external IP'S you can still use the same IP as your production domain name and just use an irule to direct traffic to the appropriate pool

Hope this helps

like image 177
CPU_BUSY Avatar answered Oct 24 '22 17:10

CPU_BUSY