开发者

How to configure a WCF service for a load balancer

开发者 https://www.devze.com 2023-01-27 19:01 出处:网络
How t开发者_开发问答o configure a WCF service for a load balancer and specific the end pointsYou could try writing a custom service host factory which will use the load balancer\'s url as base address

How t开发者_开发问答o configure a WCF service for a load balancer and specific the end points


You could try writing a custom service host factory which will use the load balancer's url as base address:

public class CustomServiceHostFactory : ServiceHostFactory
{
    protected override ServiceHost CreateServiceHost(
        Type serviceType, Uri[] baseAddresses)
    {
        Uri uri = null;
        if (baseAddresses.Length < 2)
        {
            uri = baseAddresses[0];
        }
        else
        {
            // TODO: You need to choose the load balancer's url here:
            uri = baseAddresses[????];
        }
        return base.CreateServiceHost(serviceType, new Uri[] { uri });
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号