在同一个URI上托管两个servicebus是可以接受的吗?

时间:2013-12-02 00:12:25

标签: wcf servicebus azureservicebus wcf-endpoint

我很难理解如何使用服务总线在同一个URI上的2个不同主机上托管相同的服务。 从本质上讲,这就是我们托管服务的方式。

    try
        {
            uri = ServiceBusEnvironment.CreateServiceUri(UriSchemeSb, this.serviceBusDescriptor.ServiceNamespace, servicePath);
            host = new ServiceHost(serviceType);
            host.AddServiceEndpoint(interfaceType, this.relayBinding, uri);
            AddSharedSecretServiceBusCredentialBehavior(host, this.serviceBusDescriptor.IssuerName, this.serviceBusDescriptor.IssuerKey);

            this.host.Open();
        }
        catch (SecurityTokenException exception)
        {
            this.host.Abort();
            this.host = null;               
        }

可能会发生两个主机具有相同的servicePath,并且这两个服务都托管在同一个URI上。

我认为会抛出一些异常,但似乎并非如此。 我是否误解了某些内容,或者是否为每个托管服务在URI中新生成了guid?

除了在托管服务之前测试URI之外的任何建议吗?

1 个答案:

答案 0 :(得分:0)

在这种情况下,您正在使用Service Bus的负载平衡功能。您可以拥有多个托管相同端点的主机(每个端点最多20个侦听器),这在高负载方案(循环式)或高可用性方案(一个主机关闭,其他主机继续处理)中可能是有益的 希望这有道理吗?