PowerShell调用- webrequest产生422不可处理的实体?



我在Windows 10的powershell中运行这个命令。

命令如下

Invoke-WebRequest -Uri www.example.com -Method POST -InFile FileNameHere

得到的错误是

+ Invoke-WebRequest -Uri "www.example.com ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExce
ption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

我是初学者,所以我不知道到底是怎么回事。

需要为-ContentType添加一个值。例如,

Invoke-WebRequest -Uri www.example.com -Method POST -ContentType 'text/plain' -InFile FileNameHere

最新更新