问题描述
使用C#我有两个应用
- 在.net Framework 4-客户端 上
- 以及.net framework 4.5-服务器上的另一个
并使用WCF相互交流。
“呼叫者未通过服务验证”
我知道客户端将与服务器协商并采用服务器提供的最高协议,因此已将服务器的协议强制更改为
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
但是框架4的客户端会发生什么?我也尝试过更改客户端上的协议,但没有任何变化。
解决方法
经过一番搜索,我找到了解决方法。
检查
- TLS 1.2 not negotiated in .NET 4.7 without explicit ServicePointManager.SecurityProtocol call。
- Do not disable ServicePointManagerSecurityProtocols
俗话说
“将Switch.System.ServiceModel.DisableUsingServicePointManagerSecurityProtocols设置为true会将Windows Communication Framework(WCF)传输层安全性(TLS)连接限制为使用TLS 1.0”
'如果您的应用程序以.NET Framework v4.6.2或更早版本为目标并在.NET Framework v4.7或更高版本上运行,请将开关的值设置为false。'
刚刚添加
<AppContextSwitchOverrides value="Switch.System.ServiceModel.DisableUsingServicePointManagerSecurityProtocols=false" />
到app.config并像以前一样工作!