ServicePointManager.EnableDnsRoundRobin 屬性

定義

取得或設定值,指出網域名稱服務 (DNS) 解析是否會在適用的網際網路通訊協定 (IP) 位址間循環。

public:
 static property bool EnableDnsRoundRobin { bool get(); void set(bool value); };
public static bool EnableDnsRoundRobin { get; set; }
static member EnableDnsRoundRobin : bool with get, set
Public Shared Property EnableDnsRoundRobin As Boolean

屬性值

如果 DNS 解析永遠傳回特定主機的第一個 IP 位址,則為 false,否則為 true。 預設為 false

範例

下列程式代碼範例會設定這個屬性。

ServicePointManager::UseNagleAlgorithm = true;
ServicePointManager::Expect100Continue = true;
ServicePointManager::CheckCertificateRevocationList = true;
ServicePointManager::DefaultConnectionLimit =
    ServicePointManager::DefaultPersistentConnectionLimit;
ServicePointManager::EnableDnsRoundRobin = true;
ServicePointManager::DnsRefreshTimeout = 4*60*1000; // 4 minutes
ServicePointManager.UseNagleAlgorithm = true;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;
ServicePointManager.EnableDnsRoundRobin = true;
ServicePointManager.DnsRefreshTimeout = 4*60*1000; // 4 minutes
ServicePointManager.UseNagleAlgorithm = True
ServicePointManager.Expect100Continue = True
ServicePointManager.CheckCertificateRevocationList = True
ServicePointManager.DefaultConnectionLimit = _
    ServicePointManager.DefaultPersistentConnectionLimit
ServicePointManager.EnableDnsRoundRobin = True
ServicePointManager.DnsRefreshTimeout = 4*60*1000

備註

當多個IP位址與主機名相關聯時,DNS 解析通常會只傳回第一個IP位址。 如果您將此屬性設定為 true,則後續 DNS 解析會迴圈查看特定主機的所有可用 IP 位址。 當服務使用 DNS 作為伺服器或伺服器叢集之間的負載平衡機制時,此選項非常有用。

適用於

另請參閱