ssl - 如何使用 Tls 1.3 处理 HttpWebRequest C#

标签 ssl httpwebrequest tls1.3

由于此错误消息,我无法使用 WebRequest 连接到 HTTPS 服务器 (TLS 1.3):

请求已中止:无法创建 SSL/TLS 安全通道。

以前的 TLS 版本是 1.2,使用下面的代码我可以正确获取页面,但是当页面 ssl 升级到 TLS 1.3 时,我收到了错误,而且我找不到任何解决方案:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

其实我觉得应该是这样的:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13;

但是没有。

最佳答案

看起来 TLS13 现在作为 4.8 .Net Framework 的一部分得到支持

https://learn.microsoft.com/en-us/dotnet/api/system.net.securityprotocoltype?view=netframework-4.8

但是,它仅在较新的 Windows 操作系统版本(Windows 11 和服务器 2022+)上受支持,请参阅 here了解完整的支持详情。

关于ssl - 如何使用 Tls 1.3 处理 HttpWebRequest C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55240173/

相关文章:

java - javax.net.ssl.SSLHandshakeException 故障排除

c# - HttpWebRequest 丢失 cookie

python - 属性错误: module 'ssl' has no attribute 'PROTOCOL_TLSv1_3'

android - 如何在 Android 8/9 上为 OkHttp 3.12.x 启用 TLSv1.3?

laravel - Laravel 开发中的 SSL 证书

powershell - 使用 PowerShell 在根目录中禁用证书

android - 如何通过我的 Android 应用程序对网络服务的用户进行身份验证?

c# - 为什么 HttpWebRequest.GetResponse() 在连接到 VPN 后失败?

php - 来自 nginx : should the application use it somehow? 的 $ssl_early_data

php - 带 Nodejs 的 Apache 上的 SSL