【发布时间】:2010-11-30 16:05:39
【问题描述】:
如何为负载均衡器配置 WCF 服务并指定端点
【问题讨论】:
-
您是在进行“正常”负载平衡(即将请求转发到不同的服务器),还是使用负载平衡器进行 SSL 卸载?
标签: wcf
如何为负载均衡器配置 WCF 服务并指定端点
【问题讨论】:
标签: wcf
您可以尝试编写custom service host factory,它将使用负载均衡器的 url 作为基地址:
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 });
}
}
【讨论】: