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.........