【发布时间】:2011-04-28 08:21:21
【问题描述】:
我们的核心服务器正在多个不同服务器上通过 https 调用一个肥皂网络服务,以确认交易已完成。
代码是 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)
相关的代码似乎是:
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)
在我的个人笔记本电脑 (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
结果是一样的。 SSL 错误仍然发生。
其他地方表明调用机器上没有正确安装根证书,但新服务器和旧回调服务器都使用 Go Daddy 颁发的证书,所以我认为这里不是这种情况。
【问题讨论】: