tls1.2 - FAKE F# - 在 https 请求上启用 TLS
问题描述
我在 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?这里的任何帮助将不胜感激!
解决方案
我相信这是因为您使用的是旧版本的 .net 框架(低于 4.7)。如果是这样,您可以使用 ServicePointManager 为出站呼叫设置默认和回退版本:
ServicePointManager.SecurityProtocol <- SecurityProtocolType.Tls12 ||| SecurityProtocolType.Tls11
您可以在此处找到更多详细信息
推荐阅读
- javascript - 可以将繁琐的连接和请求事件侦听器放在 Node.js 的单独模块中吗?
- python-3.x - pytesseract 无法识别图像中的字符
- asynchronous - 出站 ChannelHandler 的包罗万象的异常处理
- google-drive-api - GoogleDrive API 策略限制导出下载 10 mb
- jquery - 即使验证失败,表单也会提交
- visual-studio - QT Visual Studio Tools Embedded 编译和调试
- ms-access - 将用户名插入到 Desktp 的路径中
- bash - 从 shell 中删除文本文件的第一个字符
- java - 如果属性不为空,则使用 Hibernate 在表中插入属性
- assembly - PIC 编程:将文字移动到文件?