Bu sayfa faydalı mıydı?
Bu içerik hakkındaki geri bildiriminiz önemli. Ne düşündüğünüzü bilmemize izin verin.
İlave geri bildirim?
1500 karakter kaldı
Dışarıya aktar (0) Yazdır
Tümünü Genişlet
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

How to: Modify the Service Bus Connectivity Settings

Updated: May 18, 2015

The Microsoft.ServiceBus.ConnectivitySettings class contains settings that affect all endpoints, based on the Microsoft.ServiceBus.NetOnewayRelayBinding or Microsoft.ServiceBus.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 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 Service Bus using outbound TCP port 9351 or 9552.

If neither of these ports is available for outbound communication, you can set the SystemConnectivity property of the connectivity settings 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.

  1. You can set or modify the connectivity settings with the SystemConnectivity property. For example:

    ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;


The following example, taken from the Echo Service Bus sample, shows 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");

© 2015 Microsoft