Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Dynamics CRM:强制TLS 1.2后出现WCF安全错误_C#_Wcf_Dynamics Crm_Wcf Binding_Wcf Security - Fatal编程技术网

C# Dynamics CRM:强制TLS 1.2后出现WCF安全错误

C# Dynamics CRM:强制TLS 1.2后出现WCF安全错误,c#,wcf,dynamics-crm,wcf-binding,wcf-security,C#,Wcf,Dynamics Crm,Wcf Binding,Wcf Security,我们与Dynamics CRM有一个功能性WCF连接(2016年内部部署)。我们最近需要在Dynamics服务器上删除SSL 2.0/3.0和TLS 1.0/1.1,以满足法规遵从性(强制TLS 1.2)。这中断了我们的WCF连接。我们将看到以下错误: System.InvalidOperationException:元数据包含 无法解决: ''. --->System.Net.WebException:基础连接已关闭:发送时发生意外错误。-->System.IO.IOException: 无法

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

System.InvalidOperationException:元数据包含 无法解决: ''. --->System.Net.WebException:基础连接已关闭:发送时发生意外错误。-->System.IO.IOException: 无法从传输连接读取数据:现有 远程主机已强制关闭连接。--> System.Net.Sockets.SocketException:已创建现有连接 被远程主机强制关闭

我没有配置这个,im没有代码导出,但据我所知,连接安全性都在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
更新

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

通信对象System.ServiceModel.Channels.ServiceChannel无法用于通信,因为它处于故障状态


根据Microsoft文档:

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

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


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

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

<binding name="BasicHttpBinding_IWCFService" 

bindingConfiguration="BasicHttpBinding_IFWCFService"
我们可以使用Wireshark检查实际的TLS版本。

如果有什么我可以帮忙的,请随时告诉我。

我不确定您应该使用端口80还是端口8080。请参阅以下内容:。我还将检查IE Advance设置,以查看是否检查了TLS/SSL的正确版本。其配置为使用端口8080。我可以告诉你,我在服务器上访问该URL时没有问题,该服务器正在尝试使用任何浏览器建立WCF连接。目前,该URL为4.6感谢您的回复。为了更好地衡量,我使用4.7重新编译了我的WCF应用程序和前端应用程序(进行WCF调用)。经过大量的斗争和处理重建问题,包升级,不兼容的库和引用,我能够成功地重建。问题仍未解决
[Win32Exception(0x80004005):客户端和服务器无法通信,因为它们没有通用算法]
我还应该提到,我没有在代码中指定TLS版本。代码指向一个包含所有设置、URL和证书的XML文件。您是如何配置WCF以在服务器端启用https协议的?我想知道有关配置文件中System.Servicemodel部分的更多详细信息。此外,您的客户端没有意义,它怎么可能使用使用Securitymode=None(而不是transport)的Basichttpbinding调用https服务端点?我尝试了另一种配置(用详细信息更新了我的原始问题),现在我看到了:
通信对象System.ServiceModel.Channels.ServiceChannel,无法用于通信,因为它处于故障状态。
。正确的配置是什么?这些配置应该通过添加服务引用而不是手动配置来自动生成。要使用哪个绑定取决于服务器端的配置。另外,您能否正确访问服务器的元数据文件?您上面提到的Url表单“”。(或者可能基于Http,独立于服务的实际通信协议)。如果不是,我认为服务器端的服务配置不正确。
    <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/WCFService.svc" 
      binding="wsHttpBinding" 
      bindingConfiguration="BasicHttpBinding_IWCFService" 
      contract="WCF.IWCFService" 
      name="BasicHttpBinding_IWCFService" />
    </client>
    </system.serviceModel>
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.5.1]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.5.23026]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions"=dword:00000001
<binding name="BasicHttpBinding_IWCFService" 

bindingConfiguration="BasicHttpBinding_IFWCFService"
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;