请求已中止:无法为 HttpWebRequest 创建 SSL/TLS 安全通道

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

我正在使用 asmx web 服务客户端连接到后端 web 服务,我们有多个环境。在其中一个服务器中,出现错误 "The request was aborted: Could not create SSL/TLS secure channel" 但其他所有环境都工作正常。我已经参考了以下文章,其中 none 有帮助。

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

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

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 始终为真。

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

希望对您有所帮助!