System.ServiceModel.Security.SecurityNegotiationException:无法使用权 限'dev.xyz.com'建立SSL / TLS的安全通道

问题描述 投票:1回答:1

我的WCF服务是.Net 3.5,我的Web应用程序aspx也是.Net 3.5。我们最近从Windows Server 2010迁移到Server 2016。

我们正在纠正错误:

enter image description here……………………………………………………

我搜索了一些博客,他们建议添加代码:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

我不确定此行是否可以解决问题。

而且我也不知道如何在我的代码中使用此语句:

enter image description here

c# wcf wcf-binding wcf-security
1个回答
0
投票
此错误主要表示信任关系出了问题。由于服务器端的服务受证书保护,因此在进行呼叫之前,我们应该信任服务器证书。同时,服务器计算机和客户端计算机都将协商通过SSL/TLS协议进行的通信,该协议由操作系统和Dotnet框架版本确定。https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls信任关系可以通过以下语句建立。客户端(只需在拨打电话之前将其添加)。

ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; Uri uri = new Uri("http://10.157.13.69"); ChannelFactory<IService> factory = new ChannelFactory<IService>(new BasicHttpBinding(), new EndpointAddress(uri));

或者,我们可以在本地CA中安装服务器证书。enter image description here此行代码段通常指定TLS/SSL版本,不建议这样做,只要让OS决定TLS / SSL版本即可。

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

类似于上述用于信任服务器证书的语句,我们只是在进行呼叫之前将其添加到客户端。请随时告诉我是否有什么我可以帮助的。
© www.soinside.com 2019 - 2024. All rights reserved.