嗨,当我尝试运行时,我的 jenkins 通过 pshell 调用命令时遇到了问题:
$restoreSecProto = [Net.ServicePointManager]::SecurityProtocol
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$base64 = [System.Convert]::ToBase64String(([System.Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $cred.Username, $cred.GetNetworkCredential().Password))))
$basicAuthValue = "Basic $base64"
$headers = @{ 'Authorization' = $basicAuthValue }
$crumb = Invoke-RestMethod -Headers $headers -Uri 'https://localhost:8443/crumbIssuer/api/xml?xpath=//crumb' -SessionVariable session -UseBasicParsing
$session
$headers.Add('Jenkins-Crumb', $crumb.crumb)
错误: 调用-休息方法:基础连接已关闭:发送时发生意外错误。
请注意,CSRF 已启用
感谢您的帮助
没关系,似乎被ISE会话窃听了... :S
重新启动ISE后它可以工作