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

标签 c# asp.net .net asmx

我正在使用 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/

相关文章:

asp.net - 在计算模拟器中运行 Azure Web 角色时,web.config 文件在哪里?

c# - 使用互操作在 Excel 工作簿中写入长文本会引发错误?

.net - 如何在 ColorMatrix 中使用计算出的颜色值?

c# - Javascript : call a C# function

c# - 使用 WEB API 和 Entity Framework 项目的 IIS 本地计算机上的 "The underlying provider failed to Open"异常

c# - 根据 bool 值更改椭圆的颜色

c# - C#中的引用类型和ref有什么区别?

c# - 如何从服务获取登录用户的事件窗口

c# - MVC 远程验证中的问题

c# - 路由未定义的 Controller