简体   繁体   English

.NET 4.6.2 中 SOAP 的“无法为具有授权的 SSL/TLS 安全通道建立信任关系”

[英]“Could not establish trust relationship for the SSL/TLS secure channel with authority” for SOAP in .NET 4.6.2

I am trying to make a SOAP WCF call to an internal application from .NET 4.6.2 and I get the error above.我正在尝试从 .NET 4.6.2 对内部应用程序进行 SOAP WCF 调用,但出现上述错误。 I found a solution that I thought would work, but upon further investigation it is only applicable to .NET 4.5:我找到了一个我认为可行的解决方案,但经过进一步调查,它仅适用于 .NET 4.5:

System.Net.ServicePointManager.ServerCertificateValidationCallback +=
            (se, cert, chain, sslerror) => true;

Is there a comperable solution for .NET 4.6? .NET 4.6 是否有类似的解决方案? I am not concerned about the security implications, this is for internal testing only.我不关心安全隐患,这仅用于内部测试。

For the validation of the server certificate, you could use the following code as an alternative, it works well in Asp.net Core project as well.对于服务器证书的验证,您可以使用以下代码作为替代,它也适用于 Asp.net Core 项目。

//client is a proxy class object.
           client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication =
    new X509ServiceCertificateAuthentication()
    {
        CertificateValidationMode = X509CertificateValidationMode.None,
        RevocationMode = X509RevocationMode.NoCheck
    };

Feel free to let me know if the problem still exists.如果问题仍然存在,请随时告诉我。

ServerCertificateValidationCallback requires atleast .Net 4.5 - it should work fine in 4.6.2. ServerCertificateValidationCallback至少需要 .Net 4.5 - 它应该在 4.6.2 中正常工作。 If it isn't working try to set it before you instantiate the client.如果它不起作用,请在实例化客户端之前尝试设置它。

As a side note you really shouldn't disable validate globally, even if it is 'just for testing' as it is quite a large security issue and those famous last words before the test solution suddenly goes live and your too busy to remember to take it out!作为旁注,您真的不应该全局禁用验证,即使它“仅用于测试”,因为它是一个相当大的安全问题,并且在测试解决方案突然上线之前那些著名的遗言,而您太忙而忘记采取出来!

How exactly are you making the call?你到底是怎么打电话的? All mechanisms have also more focused ways to disable the check for just that one call.所有机制也有更集中的方法来禁用仅对一次调用的检查。

Alternatively just put a self-signed certificate on the endpoint and trust it on your dev machine, then you don't open any security holes.或者,只需在端点上放置一个自签名证书并在您的开发机器上信任它,那么您就不会打开任何安全漏洞。

暂无
暂无

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

相关问题 WCF:无法为具有权限的SSL / TLS安全通道建立信任关系 - WCF: Could not establish trust relationship for the SSL/TLS secure channel with authority 错误:无法通过授权为SSL / TLS安全通道建立信任关系 - Error: Could not establish trust relationship for the SSL/TLS secure channel with authority 无法为 SSL/TLS 安全通道建立信任关系 -- SOAP - Could not establish trust relationship for SSL/TLS secure channel -- SOAP asp.net core 2.0 中的 WCF - 无法为具有权限的 SSL/TLS 安全通道建立信任关系 - WCF in asp.net core 2.0 - Could not establish trust relationship for the SSL/TLS secure channel with authority SSL WCF“无法与权限'localhost'建立SSL / TLS安全通道的信任关系 - SSL WCF "Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost' 为什么我的客户端无法通过授权建立SSL / TLS安全通道的信任关系? - Why my client could not establish trust relationship for the SSL/TLS secure channel with authority? 无法为具有权限“本地主机”的SSL / TLS安全通道建立信任关系 - Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost' strange issue 随机抛出“无法建立SSL / TLS安全通道的信任关系” - Randomly throwing “Could not establish trust relationship for the SSL/TLS secure channel” 无法建立SSL / TLS安全通道的信任关系 - Could not establish trust relationship for the SSL/TLS secure channel WebException无法为SSL / TLS安全通道建立信任关系 - WebException Could not establish trust relationship for the SSL/TLS secure channel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM