Dynamics CRM:强制执行TLS 1.2后出现WCF安全错误

问题描述 投票:0回答:2

我们已将功能性WCF连接到我们的Dynamics CRM(2016年内部部署)。我们最近需要在Dynamics服务器上删除SSL 2.0 / 3.0和TLS 1.0 / 1.1,以符合法规要求(强制使用TLS 1.2)。这中断了我们的WCF连接。我们将看到以下错误:

System.InvalidOperationException:元数据包含一个引用,该引用无法解决:'https://DynamicsURL.com/OrgName/XRMServices/2011/Organization.svc?wsdl'。---> System.Net.WebException:基础连接已关闭:发送时发生意外错误。 ---> System.IO.IOException:无法从传输连接中读取数据:现有远程主机强行关闭了连接。 --->System.Net.Sockets.SocketException:现有连接被远程主机强行关闭

我没有配置它,并且没有代码导出,但是据我所知,连接安全性完全在web.config中,需要进行调整。看起来像这样:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IWCFService" sendTimeout="00:25:00" maxReceivedMessageSize="1000000">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://DynamicsURL.com:8080/WCF/wcfservice.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFWCFService" contract="WCF.IWCFService" name="BasicHttpBinding_IWCFService" />
    </client>
  </system.serviceModel

该问题在实施以下更改后开始:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\Multi-Protocol Unified Hello\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client]
"DisabledByDefault"=dword:00000001
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"Enabled"=dword:ffffffff
"DisabledByDefault"=dword:00000000

更新

我在调用WCF应用程序的客户端应用程序的web.config中尝试了以下system.serviceModel配置,并且收到以下错误消息:

通信对象System.ServiceModel.Channels.ServiceChannel由于处于故障状态而不能用于通信。

    <system.serviceModel>  
        <bindings>  
            <wsHttpBinding>  
                <binding name="BasicHttpBinding_IWCFService">  
                    <security mode="Transport">  
                        <transport clientCredentialType="Basic" />  
                    </security>  
                </binding>  
            </wsHttpBinding>  
        </bindings>  
          <client>
      <endpoint address="https://DynamicsURL.com:8080/WCF/FiltexWCFService.svc" 
      binding="wsHttpBinding" 
      bindingConfiguration="BasicHttpBinding_IWCFService" 
      contract="WCF.IWCFService" 
      name="BasicHttpBinding_IWCFService" />
    </client>
    </system.serviceModel>
c# wcf dynamics-crm wcf-binding wcf-security
2个回答
0
投票

根据Microsoft文档:Transport Layer Security (TLS) best practices with the .NET Framework

对于使用.NET Framework 3.5的WCF-使用带有证书凭证的TCP传输安全性的4.5.2

这些版本的WCF框架经过硬编码,以使用值SSL 3.0和TLS 1.0。这些值不能更改。您必须更新并重新定位到NET Framework 4.6或更高版本,才能使用TLS 1.1和1.2。

看起来您可能需要将WCF服务升级到.NET Framework到4.6.2或更高版本。


0
投票

首先,您的客户端连接未正确配置Https服务地址。

<binding name="BasicHttpBinding_IWCFService" 

bindingConfiguration="BasicHttpBinding_IFWCFService"

[此外,基于Dotnet Framework的TLS最佳做法。https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls我们不应干扰基础TLS版本的决定。

不指定TLS版本。配置您的代码以使操作系统确定TLS版本。

根据您的描述,为了在HTTPS上实现TLS1.2通信,我们应该在服务器端配置HTTPS服务终结点之前将Dotnetframework SDK版本升级到上述4.6.1。然后在客户端,我们也安装了上面的Dotnetframework4.6。并在调用服务器之前使用以下代码指定TLS版本。

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

我们可以使用Wireshark检查实际的TLS版本。enter image description here请随时告诉我是否有什么我可以帮助的。

© www.soinside.com 2019 - 2024. All rights reserved.