gpt4 book ai didi

c# - Servicepointmanager 设置 sercurityprotocol 异常

转载 作者:太空宇宙 更新时间:2023-11-03 13:35:10 25 4
gpt4 key购买 nike

在我的应用程序中,我想检查客户端支持的安全协议(protocol)。我有最新的 .Net 版本。

我的想法是将 SecurityProtocol 设置为 SecurityProtocolType Tls1.2,例如:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

我的问题是,如果客户端不支持 TLS1.2,ServicePointManager(SecurityProtocol) 会抛出不支持此版本的异常吗?

最佳答案

是的,你应该得到一个 NotSupportedException

在我过去做过的一些测试中,你会看到

Unhandled Exception: System.NotSupportedException: The requested security protocol is not supported. at System.Net.ServicePointManager.set_SecurityProtocol(SecurityProtocolType value)

关于c# - Servicepointmanager 设置 sercurityprotocol 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42504580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com