Describes the connectivity mode.
Assembly: Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
|Auto-detect mode. Automatically selects between the TCP, HTTP and HTTPS modes based on an auto-detection mechanism that probes whether either connectivity option is available for the current network environment. If both are available, the system will choose TCP by default.|
|HTTP mode. Listeners attempt an HTTP connection followed by an HTTPS connection with the Windows Azure Service Bus service and poll for messages. This might allow you to more easily work around TCP port constraints.|
|TCP mode (default). Listeners create TCP connections to the Windows Azure Service Bus service to a destination port in the range 9350 to 9354.|
The Windows Azure Service Bus supports only Full Trust code access security.
When using a Windows Azure Service Bus WCF binding, the default connection mode between the listener service and the Windows Azure Service Bus is TCP. However, you might be operating in a network environment that does not allow any outbound TCP connections beyond HTTP. In this case, you can configure the corresponding binding to use a more aggressive connection mode that causes the receiver to establish an HTTP connection with the Windows Azure Service Bus for retrieving relayed messages. Alternatively, you might choose to allow WCF to automatically determine whether to use TCP or HTTP for the connection to the receiver. If both are available, WCF defaults to TCP.
In some network environments, legacy proxies may not support HTTP 1.1 chunked transfer encoding, which can cause connections in the HTTP mode to fail. In this case, if the HTTP connection is not successful, the Windows Azure relay bindings will also attempt to establish the connection over HTTPS.
The client caches the protocol used when the connection is successful, and when re-connecting, will first try the cached protocol.
The following code illustrates how to modify an Windows Azure Service Bus application to use the HTTP connectivity mode through the ServiceBusEnvironment.
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http; ServiceHost host = new ServiceHost(typeof(OnewayService), address); host.Open();