gpt4 book ai didi

asp.net - .NET Framework 4.0 中的 TLS 1.2

转载 作者:行者123 更新时间:2023-12-02 04:50:26 26 4
gpt4 key购买 nike

我有一台运行十几个 .NET Framework 4.0 WebForms 应用程序的 Windows Server 2008 R2 服务器,我需要禁用 TLS 1.0 及更低版本。当我这样做时,所有安全连接都会失败,我被迫重新启用 TLS 1.0。有没有办法在framework 4.0环境中使用TLS 1.2?也许我错过了什么?

此外,由于我们使用的 CMS 版本的限制,我们目前无法升级框架。

最佳答案

如果您无法向 system.net 类库添加属性。

然后,在Global.asax文件中添加:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //TLS 1.2
ServicePointManager.SecurityProtocol = (SecurityProtocolType)768; //TLS 1.1

您可以在函数的起始行使用它:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

而且,它对于仅支持 TLS 1.1、TLS 1.2 的 STRIPE 支付网关非常有用。

编辑:在我的服务器上是否安装了 .NET 4.5 的这么多问题之后...这是我的生产服务器上的 Registry 的屏幕截图:

我只安装了 .NET Framework 4.0。

registry

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

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