gpt4 book ai didi

c# - TLS 1. 2 客户端和服务器无法通信,因为它们不具备通用算法

转载 作者:行者123 更新时间:2023-12-05 02:13:40 25 4
gpt4 key购买 nike

我对 TLS 1.2 有疑问。如果我在客户端机器上启用 tls1.0,它会起作用,但不推荐这样做。

Exception is - The client and server cannot communicate, because they do not possess a common algorithmSystem.ComponentModel.Win32Exception (0x80004005): The client and server cannot communicate, because they do not possess a common algorithm.

我的应用程序的目标框架是 .NET 4.6.2。

最佳答案

有两种可能的情况,在我的例子中我使用了第二点。

  1. 如果您在生产环境中遇到此问题并且您可以轻松地将新代码部署到生产环境中,那么您可以使用以下解决方案。

    您可以在调用 api 之前添加以下代码行,

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;//.NET 4.5

  2. 如果您无法部署新代码并希望使用生产中存在的相同代码来解决此问题,则可以通过更改配置文件中的某些配置设置来解决此问题。您可以在配置文件中添加其中之一。

<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false"/>
</runtime>

<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"
</runtime>

关于c# - TLS 1. 2 客户端和服务器无法通信,因为它们不具备通用算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54748329/

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