简体   繁体   English

VB.NET Web服务无法连接:“无法创建SSL / TLS安全通道”

[英]VB.NET Web Service connection impossible : “Could not create SSL/TLS secure channel”

I am trying to connect to a web service which is written in Java language on the server side. 我正在尝试连接到在服务器端用Java语言编写的Web服务。 My program is written in VB.NET 4.0 on the client side. 我的程序是在客户端的VB.NET 4.0中编写的。

When i try to call any methods from the web service I receive the following error message : 当我尝试从Web服务调用任何方法时,会收到以下错误消息:

WS-Metadata Exchange Error URI: [ http://...] Metadata contains a reference that cannot be resolved. WS-Metadata Exchange错误URI:[ http:// ...]元数据包含无法解析的引用。 The request was aborted: Could not create SSL/TLS secure channel 该请求已中止:无法创建SSL / TLS安全通道

I am using a certificate to connect to the web service, however it seems that the problem is on the communication level between my host machine (client) and the server. 我正在使用证书连接到Web服务,但是问题似乎出在主机(客户端)和服务器之间的通信级别上。 The certificate i am using is never been checked as the client and the server can even not communicate. 我正在使用的证书从未被检查过,因为客户端和服务器甚至无法通信。

I have tried to set the security protocol to "SSLv3" or "TLS12" but it didn't help. 我试图将安全协议设置为“ SSLv3”或“ TLS12”,但没有帮助。 Thank you in advance for any suggestions. 预先感谢您的任何建议。

Also i should mention that i managed to connect to this web service using a Java class. 我还应该提到我设法使用Java类连接到此Web服务。 It seems that when the client side is written in Java it works but when it's in VB.NET it doesn't work. 看来,当客户端使用Java编写时,它可以工作,但是当它在VB.NET中时,则不能工作。

P. HAB 哈伯

EDITED : 编辑:

I used "Wireshark" to discover the HTTPS packets which are sent and received by my program, here what I found in the transmitted packets : 我使用“ Wireshark”发现了我的程序发送和接收的HTTPS数据包,这里是我在传输的数据包中找到的内容:

Request by the client : 客户要求:

Secure Sockets Layer
TLSv1 Record Layer: Handshake Protocol: Client Hello
    Content Type: Handshake (22)
    Version: TLS 1.0 (0x0301)
    Length: 140
    Handshake Protocol: Client Hello
        Handshake Type: Client Hello (1)
        Length: 136
      Version: TLS 1.0 (0x0301)
        Random
        Session ID Length: 0
        Cipher Suites Length: 24
        Cipher Suites (12 suites)
        Compression Methods Length: 1
        Compression Methods (1 method)
        Extensions Length: 71
        Extension: server_name
        Extension: elliptic_curves
        Extension: ec_point_formats
        Extension: Extended Master Secret
        Extension: renegotiation_info

Response from the server : 来自服务器的响应:

Secure Sockets Layer
TLSv1 Record Layer: Alert (Level: Fatal, Description: Handshake Failure)
    Content Type: Alert (21)
    Version: TLS 1.0 (0x0301)
    Length: 2
    Alert Message
        Level: Fatal (2)
        Description: Handshake Failure (40)

I have tried to change the security protocol to different versions of SSL/TLS but it changed nothing. 我试图将安全协议更改为不同版本的SSL / TLS,但没有任何改变。 My client tries to send a "Client hello" with standard values (no user-customized parameters were specified) but the server is not accepting it. 我的客户端尝试发送带有标准值(未指定用户自定义参数)的“客户端问候”,但是服务器不接受它。 Any suggestions ? 有什么建议么 ?

Solution found : 找到解决方案:

The problem is in fact related to the Cipher suites and specially the RC4 algorithme. 该问题实际上与密码套件,尤其是RC4算法有关。 Actually my client is written in VB.NET 4.0 and in this version of .NET the deprecated RC4 algorithme is still supported and proposed by the .NET framework to any Web server during the "Hello Client" (Handshake) process. 实际上,我的客户端是用VB.NET 4.0编写的,并且在此版本的.NET中,.NET框架仍支持并建议在“ Hello Client”(握手)过程中将RC4算法推荐给任何Web服务器。

The only presence of the RC4 cipher suites in the supported list of the cipher suites by my client was making the server to abort the connection with the following error message : "The request was aborted: Could not create SSL/TLS secure channel" 客户端支持的密码套件列表中唯一存在RC4密码套件的原因是服务器使服务器中止连接并显示以下错误消息: “请求已中止:无法创建SSL / TLS安全通道”

So I had to deactivate the RC4 cipher suites on my client machine by going in the system registry using regedit.exe and add the following key to these two specified paths : 因此,我必须通过使用regedit.exe进入系统注册表并在以下两个指定路径中添加以下密钥来停用客户端计算机上的RC4密码套件:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft.NETFramework\\v4.0.30319 "SchUseStrongCrypto"=dword:00000001 HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft.NETFramework \\ v4.0.30319“ SchUseStrongCrypto” = dword:00000001

And

HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft.NETFramework\\v4.0.30319 "SchUseStrongCrypto"=dword:00000001 HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Wow6432Node \\ Microsoft.NETFramework \\ v4.0.30319“ SchUseStrongCrypto” = dword:00000001

After restarting the client machine I was able to connect to the web service succesfully. 重新启动客户端计算机后,我能够成功连接到Web服务。

For more information about the deprecated RC4 algorithmes : 有关不推荐使用的RC4算法的更多信息:

https://technet.microsoft.com/en-us/library/security/2960358.aspx https://technet.microsoft.com/en-us/library/security/2960358.aspx

=> Also you should notice that this problem exists only in .NET 4.0-4.5. =>另外您还应该注意,此问题仅在.NET 4.0-4.5中存在。 From the version 4.6 and above its working fine. 从4.6版及更高版本开始可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用VB.NET检索API JSON(https)(错误:取消了请求:无法创建安全的SSL / TLS通道) - Retrieve API JSON (https) with VB.NET (ERROR: Canceled the request: Unable to create a secure SSL / TLS channel) VB。 NET:请求被中止:无法在 WebClient 上创建 SSL/TLS 安全通道 - VB. NET: The request was aborted: Could not create SSL/TLS secure channel on WebClient VB。 NET:请求被中止:无法创建 SSL/TLS 安全通道 - VB. NET: The request was aborted: Could not create SSL/TLS secure channel vb无法为SSL / TLS建立安全通道 - vb Could not establish secure channel for SSL/TLS XmlReader.Create错误“无法创建SSL / TLS安全通道” - XmlReader.Create error “Could not create SSL/TLS secure channel” 无法为 SSL/TLS 安全通道建立信任关系 - SOAP 服务 - Could not establish trust relationship for the SSL/TLS secure channel - SOAP Service 我如何修复 ASP.NET 中的无法创建 SSL/TLS 安全通道错误 - How do i fix the Could not create SSL/TLS secure channel Error in ASP.NET ASP.NET“请求被中止:无法创建 SSL/TLS 安全通道”也出现在配置的 servicepointmanager 中 - ASP.NET "The request was aborted: Could not create SSL/TLS secure channel" occurs also with configured servicepointmanager Windows 7 无法创建 SSL/TLS 安全通道。"} System.Net.WebException - Windows 7 Could not create SSL/TLS secure channel."} System.Net.WebException SOAP错误:请求已中止:无法创建SSL / TLS安全通道 - SOAP Error: The request was aborted: Could not create SSL/TLS secure channel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM