gpt4 book ai didi

asp.net-mvc - 在 .NET Framework 4.0 中使用 TLS 1.2 的问题

转载 作者:行者123 更新时间:2023-12-05 01:19:07 51 4
gpt4 key购买 nike

我禁用了 TLS 1.0。因此,我们正在尝试在使用 .Net Framework 4.0 的 .Net 应用程序中使用 TLS 1.2。

我已经在开头添加了代码

System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

它在我的本地系统上完美运行。

但我不确定为什么当我在服务器(Windows Server 2008 R2)上部署代码时它不起作用。我检查了一切。 .Net 框架存在于服务器上。但它仍然只在服务器上给出同样的问题。

这里有什么我遗漏的吗?

最佳答案

根据 this post :

.NET 4.0 supports up to TLS 1.0 while .NET 4.5 supports up to TLS 1.2

However, an application targeting .NET 4.0 can still support up to TLS 1.2 if .NET 4.5 is installed in the same environment. .NET 4.5 installs on top of .NET 4.0, replacing System.dll.

所以基本上您需要将服务器升级到 .Net 4.5 以启用 TLS 1.2

此外,您还可以简化代码并使其更具可读性:

using System.Net;

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

相关 MSDN 文章:

关于asp.net-mvc - 在 .NET Framework 4.0 中使用 TLS 1.2 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41478506/

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