gpt4 book ai didi

c# - 什么设置了 C# 中使用的 TLS 版本

转载 作者:太空宇宙 更新时间:2023-11-03 14:30:16 24 4
gpt4 key购买 nike

我有一个 C# 网络应用程序,其中引用了大量项目。

根web项目设置为4.7.1框架版本

在其中一个使用 WebRequest.Create() 发出 Web 请求的子项目中,该项目也设置为 4.7.1

我的理解是 4.6 及更高版本的任何东西都使用 Tls 1.2,但是当我运行该项目时,

ServicePointManager.SecurityProtocol

解析为 SSL3

此应用程序托管在 Azure 中,不确定是否有影响

那么,什么设置决定了使用哪个 TLS?这在我们的 VM 中有效,TLS 1.2 是唯一启用的设置,但在 Azure 中无效

最佳答案

只需在应用程序启动期间或发出任何请求之前设置 SecurityProtocol 属性:

const SecurityProtocolType tlsOnly = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12
ServicePointManager.SecurityProtocol = tlsOnly;

关于c# - 什么设置了 C# 中使用的 TLS 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53326876/

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