简体   繁体   English

SoapHttpClientProtocol和TLS 1.2 - 客户端和服务器无法通信,因为它们没有通用的算法

[英]SoapHttpClientProtocol and TLS 1.2 - The client and server cannot communicate, because they do not possess a common algorithm

There are numerous posts on SO about this and I have scoured them, but still don't have a solution. 关于这一点有很多帖子,我已经搜索过它们,但仍然没有解决方案。 I am hoping that someone can point me in the right direction. 我希望有人可以指出我正确的方向。

We have a requirement now to use TLS 1.2 to connect to a remote provider. 我们现在要求使用TLS 1.2连接到远程提供程序。 So I have installed Windows Server 2016 and configured it as needed: 所以我安装了Windows Server 2016并根据需要进行了配置:

在此输入图像描述 在此输入图像描述

I know the remote server is running TLS 1.2 and that it supports the highlighted cipher. 我知道远程服务器正在运行TLS 1.2并且它支持突出显示的密码。

We connect to the remote end point using C# proxy class generated by the WSDL provided by the provider - before they converted their end to TLS (System.Web.Services.Protocols.SoapHttpClientProtocol). 我们使用由提供程序提供的WSDL生成的C#代理类连接到远程端点 - 然后将它们的结尾转换为TLS(System.Web.Services.Protocols.SoapHttpClientProtocol)。

When I connect using the proxy I get an exception with the inner exception being "The client and server cannot communicate, because they do not possess a common algorithm". 当我使用代理连接时,我得到一个异常,内部异常是“客户端和服务器无法通信,因为它们没有通用算法”。

I cannot see anywhere that ServicePointManager.SecurityProtocol so I am assuming .NET is picking up TLS 1.2 as it is the only enabled protocol? 我无法看到ServicePointManager.SecurityProtocol的任何地方,所以我假设.NET正在拿起TLS 1.2,因为它是唯一启用的协议? No idea how it is doing the cipher. 不知道它是如何做密码的。

Can someone tell me how I go about attempting to fix this? 有人能告诉我我是如何尝试解决这个问题的吗? If possible I don't want to regenerate the WSDL proxy class. 如果可能,我不想重新生成WSDL代理类。

If your client application was compiled against .NET Framework 4.5.2 or lower, then by default ServicePointManager.SecurityProtocol is initialized to SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls 如果您的客户端应用程序是针对.NET Framework 4.5.2或更低版本编译的,则默认情况下ServicePointManager.SecurityProtocol将初始化为SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls (SSL 3.0 and TLS 1.0 only), so it won't be able to connect to a remote server that requires TLS 1.2. SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls (仅限SSL 3.0和TLS 1.0),因此无法连接到需要TLS 1.2的远程服务器。

There are several ways to allow your client application to use TLS 1.2: 有几种方法可以让客户端应用程序使用TLS 1.2:

  • Recompile your client application against .NET Framework 4.6 or later. 根据.NET Framework 4.6或更高版本重新编译客户端应用程序。 (In Visual Studio, open your project's property pages, go to the Application tab, and change the Target Framework.) (在Visual Studio中,打开项目的属性页,转到“应用程序”选项卡,然后更改“目标框架”。)
  • On the client machine, run RegEdit.exe, go to HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ .NETFramework\\v4.0.30319 , add a DWORD (32-bit) value named SchUseStrongCrypto , and set it to 1. (This flag causes ServicePointManager.SecurityProtocol to be initialized to Tls | Tls11 | Tls12 .) 在客户端计算机上,运行RegEdit.exe,转到HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ .NETFramework\\v4.0.30319 ,添加名为SchUseStrongCrypto的DWORD(32位)值,并将其设置为1.(此标志导致ServicePointManager.SecurityProtocol初始化为Tls | Tls11 | Tls12 。)
  • When your client application starts up, turn on TLS 1.2: ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; 启动客户端应用程序时,启用TLS 1.2: ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

There's no need to regenerate your proxy class because it's not responsible for negotiating the TLS protocol or cipher. 无需重新生成代理类,因为它不负责协商TLS协议或密码。

I had this issue removing TLS 1.0 from a website that was connecting to a web service. 我有这个问题从连接到Web服务的网站中删除TLS 1.0。 For me it was a httpRuntime that was stuck on 4.5.1 in web.config of the web service. 对我来说,这是一个httpRuntime,它停留在web服务的web.config中的4.5.1。 The service was changed to 4.6.1, changing the version of httpRuntime in the web.config to 4.6.1 fixed the issue. 该服务已更改为4.6.1,将web.config中的httpRuntime版本更改为4.6.1修复了该问题。 The web site tried to set up TLS to the webservice and only has 1.2 and 1.1 available. 该网站试图将TLS设置为Web服务,并且只有1.2和1.1可用。 The web service only supported 1.0 so that caused the error. Web服务仅支持1.0,因此导致错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法创建SSL / TLS安全通道。客户端和服务器无法通信,因为它们没有通用算法 - Could not create SSL/TLS secure channel. The client and server cannot communicate, because they do not possess a common algorithm TLS 1. 2 客户端和服务器无法通信,因为它们没有通用算法 - TLS 1. 2 The client and server cannot communicate, because they do not possess a common algorithm 客户端和服务器无法通信,因为它们没有通用的 WCF 算法 - The client and server cannot communicate, because they do not possess a common algorithm WCF 客户端和服务器无法通信,因为它们没有共同的算法 - ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 - Win32 - The client and server cannot communicate, because they do not possess a common algorithm - ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 - Win32Exception 客户端和服务器无法通信,因为它们在Windows Server 2008 Web上不具有通用算法 - The client and server cannot communicate, because they do not possess a common algorithm on Windows Server 2008 Web 客户端和服务器无法通信,因为它们没有通用的算法C#SslStream - The client and server cannot communicate, because they do not possess a common algorithm, C# SslStream SSLStream.AuthenticateAsServer “客户端和服务器无法通信,因为它们没有通用算法” - SSLStream.AuthenticateAsServer “The client and server cannot communicate, because they do not possess a common algorithm” C# 客户端和服务器无法通信,因为它们没有通用的算法 - C# The client and server cannot communicate, because they do not possess a common algorithm ASP.NET 4.5客户端和服务器无法通信,因为它们不具有通用算法 - ASP.NET 4.5 The client and server cannot communicate, because they do not possess a common algorithm HTTP Web 请求 TLS 1.3 C# .NET 核心 3.1 异常“客户端和服务器无法通信,因为它们不具备通用算法。” - HTTP Web Request TLS 1.3 with C# .NET Core 3.1 exception "The client and server cannot communicate, because they do not possess a common algorithm."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM