无法为SOAP调用建立SSL/TLS的安全通道

Zar*_*ani 10 .net vb.net ssl wcf soap

我们的核心服务器通过https在多个不同的服务器上调用soap Web服务,以确认事务已完成.

代码是dotnet 3.5(vb),适用于我们设置的各种回调服务,直到我们将新的服务转移到生产环境中并拒绝通信,给出以下错误:

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException:
Could not establish secure channel for SSL/TLS with authority 'www.xyzzy.com'.
---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Run Code Online (Sandbox Code Playgroud)

相关的代码片段似乎是:

Dim epAddr As New System.ServiceModel.EndpointAddress(sys.CallbackAddress)
Dim bind As New System.ServiceModel.BasicHttpBinding(ServiceModel.BasicHttpSecurityMode.Transport)

_svc = New CallbackSvc.XyzzyCallbackSoapClient(bind, epAddr)
Run Code Online (Sandbox Code Playgroud)

从我的个人笔记本电脑(WinXP),我可以运行代码,它连接到新服务器没有问题.

从主服务器(调用所有回调服务)(Windows Server Enterprise Service Pack 1),代码始终导致上述SSL错误.

谷歌搜索后,我尝试添加以下行(当然不适合生产,但我想测试):

System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(se As Object, cert As System.Security.Cryptography.X509Certificates.X509Certificate, chain As System.Security.Cryptography.X509Certificates.X509Chain, sslerror As System.Net.Security.SslPolicyErrors) True
Run Code Online (Sandbox Code Playgroud)

结果是一样的.SSL错误仍然发生.

其他地方建议根证书没有在呼叫机器上正确安装,但新服务器和旧回调服务器都使用Go Daddy颁发的证书,所以我不认为这是这种情况.

Zar*_*ani 9

结果是生产"核心"服务器(调用服务的服务器)和目标服务器(托管服务)之间的交互不共享可接受的https算法. wfetch在诊断问题时非常有帮助.

事实证明,目标服务器未设置为接受TLS 1.0,仅接受SSL 3.0.

显然,在Windows 2008 Server中发生了一些变化,这意味着只有使用TLS 1.0(或者更好,大概是)可以接受出站https连接.

在我们的示例中,当目标服务器上的配置更改为接受TLS时,问题已得到解决.感觉应该有一种方法来改变我的程序以强制它使用SSL,但我还没有找到它.


小智 6

在客户端,尝试:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
Run Code Online (Sandbox Code Playgroud)