Powershell使用基本身份验证下载文件
我正在尝试使用PowerShell从我的JFrog repo下载一个文件,但无法使其正常工作 这就是我得到的错误: Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error occurred on a send." At C:\Users\jelte\Documents\myproject\downloadExecutables1.ps1:16 char:1 + $req.DownloadFile('https://myrepo.jfrog.io/myproject/libs-release-loca ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException 我尝试过的事情:Powershell使用基本身份验证下载文件,powershell,Powershell,我正在尝试使用PowerShell从我的JFrog repo下载一个文件,但无法使其正常工作 这就是我得到的错误: Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error occurred on a send." At C:\Users\jelte\Documents\myproject\downloadExecuta
Invoke Webrequest
,这可以工作,但速度非常慢尝试将这些行添加到脚本的开头
$AllProtocols = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
我也经历过类似的情况,但没有一条信息非常丰富的错误消息,问题显然只是我需要将powershell使用的安全协议设置为Tls 1.2。您使用的代码正是我下载具有授权的文件所需的代码。谢谢
$AllProtocols = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols