ServicePointManager 类

地址:https://docs.microsoft.com/zh-cn/dotnet/api/system.net.servicepointmanager?redirectedfrom=MSDN&view=netframework-4.7.2

 

管理 ServicePoint 对象集合。

下面的代码示例创建 ServicePoint 对象以连接到 URI www.contoso.com

Uri myUri = new Uri("http://www.contoso.com/");
 
ServicePoint mySP = ServicePointManager.FindServicePoint(myUri);

 

ServicePointManager 是一个静态类,用来创建、维护和删除 ServicePoint 类的实例。

当应用程序通过 ServicePointManager 对象请求与 Internet 资源统一资源标识符(URI)的连接时,ServicePointManager 将返回一个 ServicePoint 对象,其中包含由 URI 标识的主机和方案的连接信息。 如果该主机和方案存在现有 ServicePoint 对象,则 ServicePointManager 对象返回现有 ServicePoint 对象;否则,ServicePointManager 对象会创建一个新的 ServicePoint 对象。

4.6 .NET Framework 包括一项新的安全功能,用于阻止连接的不安全密码和哈希算法。 默认情况下,通过 Api (例如 HttpClientHttpWebRequestFtpWebRequestSmtpClient、4.6 SslStream等)使用 TLS/SSL 的应用程序将获得更安全的行为。

开发人员可能需要选择退出此行为,以便与现有的 SSL3 服务或具有 RC4 服务的 TLS 保持互操作性。 本文介绍如何修改代码,以便禁用新行为。

posted on 2019-11-15 10:21  荆棘人  阅读(3234)  评论(0编辑  收藏  举报

导航