I have fiddled around with both System.Net.HttpWebRequest and Invoke-WebRequest (I know that beneath it is the same code) and both gives a 500 status in the following scenario:
$response = Invoke-WebRequest 'https://httpstat.us/200?sleep=270000' -TimeoutSec 360000
How can this be? httpstat.us is clearly set to only wait for 4.5 min. and the timeout is way above that, but all I get is a:
Invoke-WebRequest : 500 - The request timed out. The web server failed to respond within the specified time. At line:1 char:13 + $response = Invoke-WebRequest 'https://httpstat.us/200?sleep=270000' ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
It seems to me, that there's a maximum timeout of the request (about 3-4 min.). Anobody knows what to do?
I have set up this scenario because I have a website that I need to test that has a long response time.