【发布时间】:2020-03-06 10:45:46
【问题描述】:
我的 WPF(桌面)应用程序正在调用两种类型的服务 - 一种 WCF 服务托管在我们的内部环境中,另一种是第 3 方 Web 服务。
我的应用程序正在使用 .Net framework 4.0。由于最近在组织上应用了一些 Windows 更新,我的第 3 方网络服务停止工作,我开始收到此错误
"System.ServiceModel.Security.SecurityNegotiationException: Could not establish secure channel for SSL/TLS with authority 'abc.net'. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel. "
为了解决我在调用 3rd 方网络服务之前添加了这一行。
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
而且,它开始完美运行。但是,它影响了我内部托管的 WCF 服务。我的 WCF 服务开始出现同样的错误。奇怪的是,我每次都没有得到错误,它突然发生,当我们重新启动应用程序时,WCF 服务调用再次开始正常工作。
错误:
"System.ServiceModel.Security.SecurityNegotiationException: Could not establish secure channel for SSL/TLS with authority 'abc.net'. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel."
一些 WCF 服务配置细节:
<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
----
<serviceBehaviors>
<behavior name="WcfServerSyncService.LocalDataCacheSyncServiceBehavior">
<serviceMetadata httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfServerSyncService.CustomValidator,WcfServerSyncService" />
</serviceCredentials>
</behavior>
<serviceBehaviors>
而且,只有特定的一组用户会收到此错误,而不是全部。但是,对于这些用户来说,这有时会起作用,有时不会。
有什么建议吗?
【问题讨论】:
标签: wcf wcf-security