Invoke-RestMethod hangs on long running endpoints Invoke-RestMethod hangs on long running endpoints powershell powershell

Invoke-RestMethod hangs on long running endpoints


We were able to resolve this problem by adding the -DisableKeepAlive switch to the Invoke-RestMethod command. It seems the HTTP keep-alive feature prevented PowerShell from concluding those long running calls.