我在F#上有一些旧代码
Sub export()
Dim myPath, folderPath, fileName, exportFileFullPath As String
Dim arrayOfSheetsToCopy As Variant
folderPath = Application.ActiveWorkbook.Path
fullPath = Application.ActiveWorkbook.FullName
fileName = Replace(Application.ActiveWorkbook.Name, ".xlsm", "")
exportFileFullPath = folderPath & "\" & fileName & "_export.xlsx"
Workbooks.Add
ActiveWorkbook.SaveAs fileName:=exportFileFullPath, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
arrayOfSheetsToCopy = Array("originalSheet1", "originalSheet2", "originalSheet3")
Workbooks(fullPath).Sheets(arrayOfSheetsToCopy).Copy After:=Workbooks(exportFileFullPath).Sheets(Sheets.Count)
End Sub
从某些时候开始,它失败并显示以下错误
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"
]
)
我怀疑这是由于最近Web服务器仅对TLS 1.2的限制。 我该如何解决?如何仅选择TLS1.2? 任何帮助都将不胜感激!
答案 0 :(得分:1)
我相信这是因为您使用的是.net框架的旧版本(低于4.7)。 如果是这样,您可以使用ServicePointManager设置拨出电话的默认版本和后备版本:
ServicePointManager.SecurityProtocol <- SecurityProtocolType.Tls12 ||| SecurityProtocolType.Tls11
您可以找到更多详细信息here