How to: Modify the Service Bus Connectivity Settings
The ConnectivitySettings class contains settings effective for all endpoints, based on the NetOnewayRelayBinding or NetEventRelayBinding bindings, that are active in the current application domain. The reason for the shared nature of these settings is that the connectivity path to the Service Bus is identical across all endpoints in the same process. Most corporate network environments prefer to limit ports opened to outbound traffic, and typically restrict outbound HTTP and TCP traffic to the same narrow range of ports.
By default, all service endpoints listening for messages using one of these two bindings connect to the Service Bus using outbound TCP port 828 (for SSL-protected connections) or outbound TCP port 808.
If neither of these ports is available for outbound communication, the SystemConnectivity property of the connectivity settings can be set to Http, which enables the HTTP polling through outbound ports 80 and 443 using RFC 2616-compliant HTTP requests. RFC 2616 strongly recommends constraining the concurrent requests to a particular domain be limited to two, and the operating system and networking devices or upstream proxies can enforce that limit. Considering that, the HTTP polling mode is using a single HTTP connection to implement polling. All messages destined for all one-way and event endpoints in the current application domain are multiplexed through the HTTP polling connection and distributed locally.
To set or modify the Service Bus connectivity settings
Set or modify the connectivity settings with a call to SystemConnectivity.
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;
The following example, taken from the Echo sample in the Windows Azure SDK, describes how to set the connectivity mode in a command-line application.
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http; Console.Write("Your Service Namespace (ex. sb://<ServiceNamespace>.servicebus.windows.net/): "); string serviceNamespace = Console.ReadLine(); Console.Write("Your Issuer Name: "); string issuerName = Console.ReadLine(); Console.Write("Your Issuer Secret: "); string issuerSecret = Console.ReadLine(); // Create the service URI based on the service namespace name. Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService");