【问题标题】:Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send. - jenkinsInvoke-RestMethod :底层连接已关闭:发送时发生意外错误。 - 詹金斯
【发布时间】:2020-05-15 00:46:09
【问题描述】:

您好,我在尝试运行时通过 pshell 调用 jenkins 命令时遇到问题:

$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) 

错误: Invoke-RestMethod : 底层连接已关闭:发送时发生意外错误。

请注意 CSRF 已启用

感谢帮助

【问题讨论】:

    标签: powershell jenkins


    【解决方案1】:

    没关系,似乎 ISE 会话被窃听了......:S

    重启 ISE 后就可以了

    【讨论】:

      猜你喜欢
      • 2023-01-25
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多