win10安裝Chocolatey報"請求被終止,未能建立SSL/TLS安全通道"
阿新 • • 發佈:2022-04-19
以管理員身份執行
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/instal...'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin
報如下錯誤
另外一臺電腦運行同樣的指令不報錯,也能開啟https://chocolatey.org/install.ps1
參考官方給出的troubleshooting ,應該是TLS版本的問題
在Power shell執行下面3條指令
1.
[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'
2.If the result is True then your system supports TLS 1.2. You can find out which protocols are being used by running:
[System.Net.ServicePointManager]::SecurityProtocol.HasFlag([Net.SecurityProtocolType]::Tls12)
3.If the result is True then TLS 1.2 is being used . However, you can add TLS 1.2 explicitly by using:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
我的情況是步驟2返回false,執行第3條後再執行Chocolatey安裝指令問題解決~