在本地服务总线1.1 SDK(非Azure云)中是否支持中继

时间:2014-01-09 16:24:18

标签: c# wcf azure

On-Premises Service Bus 1.1 SDK(非Azure云)支持中继

下面的代码在Azure云服务总线中托管时工作正常,但在内部部署服务总线1.1中不起作用。

代码:

ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;
string serviceNamespace = "ServiceBusDefaultNamespace";
string issuerName = "owner";
string issuerSecret = "[Secret Key Here]";
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;
var address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace,    "EchoService");
var binding = new NetTcpRelayBinding();
var behavior = new TransportClientEndpointBehavior(); 

binding.Security.Mode = EndToEndSecurityMode.Transport;
binding.Security.RelayClientAuthenticationType =     RelayClientAuthenticationType.RelayAccessToken;

behavior.TokenProvider = TokenProvider.CreateSharedSecretTokenProvider(issuerName,   issuerSecret);
ServiceHost host = new ServiceHost(typeof(EchoService));
var endpoint = host.AddServiceEndpoint(typeof(IEchoContract), binding, address);
endpoint.Behaviors.Add(behavior);
host.Open();

实例化ServiceHost时出错

1 个答案:

答案 0 :(得分:0)

Windows Service Bus 1.1不支持中继,但只支持基于队列的消息传递。

此问题已在此处提出并回答:Relay binding not working for Window Server Service Bus 1.1