Invoke-WebRequest timeout issue

Dear Guys for Octopus Team,

I’ve an issue with powershell invoke-webrequest (it also happens using invoke-restmethod) web call. The issue is not consistent and appears randomly but quite often. Sometimes the call request is taking a really long time and when i look in the IIS -> Worker Processes for the target website the call doesn’t seem to be in process on the server. In that case it will always timeout to after set amount of time.

How can i approach that issue?


Thanks for reaching out.

From the brief info you provided, it seems like a problem with the Web API hosted in IIS or the connectivity to it. Can’t see how something in Octopus would be affecting this.

  • Are you trying to run this Powershell script from a step in Octopus?
  • During the Octopus deployment, is this script being executed from the same machine hosting the Web app to which you are trying to hit, or is it being executed from a remote machine?
  • If you log into this remote machine and run the script manually, does it behave the same as when you run it from Octopus?


Hi Dalmiro,

Thanks for a quick reaction. My current setup is that i have a “Run script” step that allows me to wake up the app and do so fancy stuff. The script is executed for and running from the same machine as the WebSite is.

I’ve also RDP to my VM yesterday and tried that script manually. The script worked without any problems.

Any other suggestions?

One of the first things I’d do is try to modulirize the code into sets, and then print on screen how much is each part taking to run.

For example you are saying: i have a "Run script" step that allows me to wake up the app and do so fancy stuff.

  • How much does it take to wake up the app from your script from Octopus?
  • How much Fancy Stuff #1
  • How much Fancy Stuff #2
  • etc

This should help us get into the right direction for the troubleshooting.