0

我很难理解如何使用服务总线在同一 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 之外还有什么建议吗?

4

1 回答 1

0

You are using the Load Balancing feature of Service Bus in that case. You can have multiple hosts hosting the same endpoint (up to 20 listeners per endpoint), which can be beneficial in high load scenarios (round-robin style) or high availability scenarios (one host is down, other continues to process) Hope this makes sense?

于 2013-12-02T08:22:55.240 回答