为什么会收到“ Invoke-RestMethod:未找到”错误?

时间:2019-12-03 22:25:20

标签: powershell powershell-core

我正在尝试调用使用Invoke_RestMethod调用的Powershell脚本。 Powershell脚本的工作原理与同事的计算机相同,但在我的计算机上却完全不一样。我收到以下错误

15:47:48.270 Invoke-RestMethod : Not Found
15:47:48.271 At C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\ToscaCI\Client\deliver.ps1:15 char:1
15:47:48.272 + Invoke-RestMethod -Body $body -Method 'Post' -Uri $url

这就是我所称的powershell脚本delver.ps1

$url = 'https://pulse-us-east-1.qtestnet.com/webhook/b9303bb6-d0e1-43ce-bf96be4a3b330c8f'

Set-Location -Path "C:\Tosca_Projects\Tosca_Workspaces\First Steps\Test Results"

$payload = (Get-Content "result.xml" -Raw)

$body = @{
'projectId' = '95814'
'test-cycle' = '3539385'
'requiresDecode' = 'true'
'result' = $payload
}

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Body $body -Method 'Post' -Uri $url

我正在运行Windows 10 Powershell版本5.1.17763.503,甚至升级到了Powershell 6.2.3,并且遇到相同的错误

0 个答案:

没有答案