我已經提供了一個新的Server 2012框進行設置。使用powershell連接到HTTPS站點
我試圖使用PowerShell安裝的巧克力
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
,並得到錯誤
Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error occurred on a receive." At line:1 char:1 + iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/in ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException
我可以在瀏覽器中訪問that URL。
起初我還以爲這是什麼做的巧克力,但後來我意識到,
(New-Object System.Net.WebClient).DownloadString('http://google.com'))
可以下載HTML內容
但
((New-Object System.Net.WebClient).DownloadString('https://google.com'))
失敗相同的錯誤
The underlying connection was closed: An unexpected error occurred on a receive.
盒:
- 是Windows Server 2012中構建9600
- 不使用代理
- 已防火牆關閉
我確信我米做一些愚蠢的事,但看不到什麼...
---更新---
我按照這些步驟:
``` 1.In控制面板,單擊管理工具,然後雙擊本地安全策略。
2.在本地安全設置中,展開本地策略,然後單擊安全選項。
3.在右窗格中的策略下,雙擊系統加密:使用FIPS兼容算法進行加密,散列和簽名,然後單擊啓用。
- 冉運行gpupdate/force ```
,所述的巧克力後安裝腳本可被下載但隨後失敗:
STDOUT: FIPS Mode detected - run 'choco feature enable -n useFipsCompliantChecksums' to use Chocolatey. When FIPS Mode is enabled, Chocolatey requires useFipsCompliantChecksums feature also be enabled. STDERR: ---- End output of C:\ProgramData\chocolatey/bin/choco.exe list -l -r ---- Ran C:\ProgramData\chocolatey/bin/choco.exe list -l -r returned 1
仍然覺得不應該有必要改變GPO
嘗試在下載內容之前執行以下操作:'[System.Net.ServicePointManager] :: ServerCertificateValidationCallback = {$ true}' –
可以在命令中依次運行行?如果是這樣,則不起作用。但也是否會關閉證書驗證?這感覺有點危險 –
是的,這會關閉證書驗證。例如,如果您使用自簽名證書並且不想將其安裝在所有客戶端上,那麼這很有用。 G。測試目的。但是,這可能不是你的問題 –