Frage

I'm looking for the correct way to have redundancy for a WCF service. I think I'm trying to solve a "infrastructure" issue in code. I'm not up to speed on load balancers but it seems like there should be something like routers to exactly this.

// Cycle through the list of service.
foreach (var uri in InfrastructureInformation.ServiceUris)
{
    try
    {
        using (var client = WcfClientFactory.Create<ServiceClient>(uri))
        {
            // Do stuff here.
        }
    }
    catch
    {
        // todo: Do not catch "exception" here. We have to find a better way of doing this.
        // Try the next URI.
    }
}

Seems like there should be a way to have one URI that I could hit that some "balancer" would hand off to an available service. If one service goes down for maintenance then the balancer would just not give any request to that service.

Now I know about WCF routing and I thought well that's the answer. Just put up a WCF router and have it hand out the connection but what happens if it falls over? Doesn't this give you a single point of failure? I'm looking for something more industrial.

War es hilfreich?

Lösung

WCF in .NET 4.0 has a routing capability that can be used in a failover scenario like you describe. This WCF sample shows how the built-in RoutingService class can be used for this purpose.

Andere Tipps

You could have a look at Microsoft Network Load Balancing (aka NLB). Microsoft also mention this in the context of WCF. There is an article on this here.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top