gpt4 book ai didi

c# - 请求被中止 : Could not create SSL/TLS secure channel for HttpWebRequest

转载 作者:太空宇宙 更新时间:2023-11-03 15:03:27 24 4
gpt4 key购买 nike

我正在使用 asmx web 服务客户端连接到后端 web 服务,我们有多个环境。在其中一个服务器中,出现错误“请求被中止:无法创建 SSL/TLS 安全通道”,但其他所有它工作正常的环境。我已经引用了以下文章,但没有任何帮助。

The request was aborted: Could not create SSL/TLS secure channel.

The request was aborted: Could not create SSL/TLS secure

HttpWebRequest: The request was aborted: Could not create SSL/TLS secure channel

HttpWebRequest The request was aborted: Could not create SSL/TLS secure channel

最佳答案

If the issue is server specific ,you may be running into any issue with Server Certification validation check (because of the Root Certificate missing) or CRL check failure ,then following code might help.Add this to your project and verify

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;

请注意,这不是一个好方法,因为我们只是让所有 ServerCertificateValidation 始终为真。

如果服务器验证是问题,正确的做法是确保您可以从机器成功访问 https url。您可以使用任何浏览器浏览到该 URL,它应该能够成功浏览而不需要任何警告。如果出现任何警告(例如证书不受信任),请验证错误并确保安装了所需的根证书等

希望这对您有所帮助!

关于c# - 请求被中止 : Could not create SSL/TLS secure channel for HttpWebRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44941237/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com