Does relay supported in the On-Premises Service Bus 1.1 SDK (Not Azure Cloud)
Below code works fine when hosted in Azure Cloud Service Bus but does not work in the On-Premises Service Bus 1.1.
Code:
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();
Error while instantiating the ServiceHost