ServicePointManager.EnableDnsRoundRobin 属性

定义

获取或设置一个值,该值指示域名服务 (DNS) 解析是否在多个适用的 Internet 协议 (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 作为服务器或服务器群集之间的负载均衡机制时,此选项非常有用。

适用于

另请参阅