【问题标题】:FAKE F# - enable TLS on https requestsFAKE F# - 在 https 请求上启用 TLS
【发布时间】:2020-08-05 15:52:13
【问题描述】:

我在 F# 上有一些遗留代码

                let response = 
                    Http.Request (
                        ArtifactoryUrl, 
                        silentHttpErrors = true,
                        httpMethod = "POST", 
                        body = HttpRequestBody.TextRequest requestJson,
                        headers = [ 
                            HttpRequestHeaders.BasicAuth ArtifactoryUserName ArtifactoryPassword
                            HttpRequestHeaders.ContentType "application/json"
                            HttpRequestHeaders.Accept "application/json"
                        ]
                    )

从一段时间开始,它失败并出现以下错误

exception: System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.

我怀疑这是由于最近的网络服务器仅限于 TLS 1.2。 我该如何解决?如何仅选择 TLS1.2? 这里的任何帮助将不胜感激!

【问题讨论】:

    标签: tls1.2 f#-fake


    【解决方案1】:

    我相信这是因为您使用的是旧版本的 .net 框架(低于 4.7)。 如果是这样,您可以使用 ServicePointManager 为出站呼叫设置默认和回退版本:

    ServicePointManager.SecurityProtocol <- SecurityProtocolType.Tls12 ||| SecurityProtocolType.Tls11
    

    您可以找到更多详情here

    【讨论】:

      猜你喜欢
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      • 2019-04-26
      • 2021-05-03
      • 1970-01-01
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      相关资源
      最近更新 更多