Discussion Issuw with ServiceBus Relay Bindings

  • Tuesday, August 28, 2012 3:58 AM
     
     

    Hi Team

    I am new to the Azure Service Bus. I am trying to use the relay messaging of the service bus to expose my basic on premise wcf service..

    I created the basic service and hosted it in the console Application. The hosting code looks like this:

     ////Using BasichttpRelayBinding
                ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

    // Configure the credentials for the service and client endpoints through an endpoint behavior.

    var endPoint = new TransportClientEndpointBehavior();

    endPoint.CredentialType =TransportClientCredentialType.SharedSecret;

    endPoint.Credentials.SharedSecret.IssuerName ="owner";

    endPoint.Credentials.SharedSecret.IssuerSecret = "mysecret=";

    // Create the binding with custom settings.

    var binding = new BasicHttpRelayBinding();

    binding.Security.RelayClientAuthenticationType =RelayClientAuthenticationType.RelayAccessToken;

    // Get the service URI.       [below testServer is the namespace of Service bus we created in Azure in start]

    var address = ServiceBusEnvironment.CreateServiceUri("https", "mynamespace", "ProblemSolver");

    // Create the service host.

    var host = new ServiceHost(typeof(ProblemSolver), address);

    // Add the service endpoint with the WebHttpRelayBinding binding.

    host.AddServiceEndpoint(typeof(IProblemSolver), binding, address);

    // Add the credentials through the endpoint behavior.

    host.Description.Endpoints[0].Behaviors.Add(endPoint);

    //host.Description.Endpoints[0].Behaviors.Add(new MyBehavior());

    host.Description.Behaviors.Add(new ServiceMetadataBehavior() { HttpsGetEnabled = true });

    ServiceRegistrySettings settings = new ServiceRegistrySettings();

    settings.DiscoveryMode =DiscoveryType.Public;

    foreach (ServiceEndpoint s in host.Description.Endpoints)

    s.Behaviors.Add(settings);

    ServiceDebugBehavior debug = host.Description.Behaviors.Find<ServiceDebugBehavior>();

    // if not found – add behavior with setting turned on 

    if (debug == null)

    {

    host.Description.Behaviors.Add(new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true });

    }

    else

    {

    // make sure setting is turned ON

    if (!debug.IncludeExceptionDetailInFaults)

    {

    debug.IncludeExceptionDetailInFaults =true;

    }

    }

    // Start the service.

    host.Open();

        Console.WriteLine("Copy the following address into a browser to see the data: ");

        Console.WriteLine(address );

        Console.WriteLine();

        Console.WriteLine("Press [Enter] to exit");

    Console.ReadLine();

    host.Close();

    The problem is, when i run this code my console application hangs at the host.Open() call and never move forward. I do not get any error or warning though.

    Can you please help me with this? I also tried nettcprelaybinding and the result is same.

    By reading some forums, i came to know that outbound port 9350-9354 needs to be opened on firewall, i tried that also but no luck. Even turning off the firewall doesn't help..


    Deepak Sanghi Happy Biztalking.........

All Replies

  • Tuesday, August 28, 2012 7:10 AM
     
     
    Have you checked your windows event log for possible (error) messages around the time you tried connecting?
  • Tuesday, August 28, 2012 2:19 PM
     
     
    No error in Event viewer. As i said in description that the exe stops at the host.open() and stays there. This give no error.

    Deepak Sanghi Happy Biztalking.........

  • Tuesday, August 28, 2012 4:36 PM
     
     

    Why dont you try the sample from azure training kit and see if it works for you first?

    Download the training kit from here



    Please mark the replies as Answered if they help and Vote if you found them helpful.

  • Thursday, November 29, 2012 2:57 PM
     
     

    I have the same problem with running aServiceBus app from inside one of our  clients network. In other networks it works without a problem, there, it hangs on host.Open(). There are no errors in the Eventlog and no exception is raised. The network doesn't use a proxy server and port 80 is open to connect out to the internet.

    Any help would be appreciated.