Jun 21, 2016 at 8:18 PM
Edited Aug 5, 2016 at 1:52 PM
Hello, first of all I congratulate you for the excellent work!

I want to define an Endpoint NetTcpRelayBinding of Azure. But NetTcpRelayBinding is not supported.

Thank you!

        var sh = new ServiceHost(typeof(ProblemSolver));

        #region Local
               typeof(IProblemSolver), new NetTcpBinding(),

        #region Azure
               typeof(IProblemSolver), new NetTcpRelayBinding(),
               ServiceBusEnvironment.CreateServiceUri("sb", "endpoint", "solver"))
                .Behaviors.Add(new TransportClientEndpointBehavior
                    TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "PASSWORK")

Aug 5, 2016 at 2:17 AM

I have not worked with Service Bus extensively but I think you can configure everything in the config file (if you do not have anything extra). From your code, it looks like you are trying to create a host programmatically. You should be able to create an endpoint configuration that uses the binding and connects to Service Bus without any code. Below is a snipper from one of my previous project. It does not directly provide you with the answer to your netTcpRelay but hopefully it can give you some ideas.
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./ExpenseService.svc" service="AzureWebApp.Services.ExpenseService" />
      <service name="AzureWebApp.Services.ExpenseService" behaviorConfiguration="DefaultServiceBehavior">
        <endpoint name="basicRelayHttpExpenseService" address="" 
                  binding="basicHttpRelayBinding" contract="AzureWebApp.Services.Contracts.IExpenseService"
You will also need to set a custom endpoint behavior.
      <!-- Service Bus endpoint behavior-->
        <behavior name="sharedSecretClientCredentials">
          <transportClientEndpointBehavior credentialType="SharedSecret">
              <sharedSecret issuerName="owner" issuerSecret="[Put Your secret key here]" />
          <serviceRegistrySettings discoveryMode="Public"/>
Best Regards
Marked as answer by BigMaster2004 on 8/5/2016 at 5:53 AM