Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 内部部署服务总线1.1 SDK是否支持中继(非Azure云)_C#_Wcf_Azure - Fatal编程技术网

C# 内部部署服务总线1.1 SDK是否支持中继(非Azure云)

C# 内部部署服务总线1.1 SDK是否支持中继(非Azure云),c#,wcf,azure,C#,Wcf,Azure,内部部署服务总线1.1 SDK中支持的中继是否不是Azure云 以下代码在Azure云服务总线中托管时可以正常工作,但在本地服务总线1.1中不工作 代码: 实例化ServiceHost时出错。Windows Service Bus 1.1不支持中继,只支持基于队列的消息传递 这里已经提出并回答了这个问题: ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect; string serviceNames

内部部署服务总线1.1 SDK中支持的中继是否不是Azure云

以下代码在Azure云服务总线中托管时可以正常工作,但在本地服务总线1.1中不工作

代码:


实例化ServiceHost时出错。Windows Service Bus 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();