任何人都可以帮助我解决Invokerestmethod中的此错误


Invoke-RestMethod : The underlying connection was closed: An unexpected error 
occurred on a send.## Heading ##
At DesktopT.ps1:27 char:7
+ $CS = Invoke-RestMethod -Method PUT -Uri https://XXXX ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
pWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
ll.Commands.InvokeRestMethodCommand

您的错误出现在脚本T.ps1的行:27 char:7中,它与Invoke-ResMethod cmdlet有关。我将给您一个关于如何使用Invoke-RestMethod的示例。

调用RestMethod-Uri"放置您想要请求的dns或ip"-Method(POST或Get(

请求谷歌的工作示例:

Invoke-RestMethod -Uri "https://www.google.com" -Method GET

这必须返回谷歌网页的html代码

最新更新