I’m using the code below, but I get a message (because of the catch) with error: “The underlying connection is closed: An unexpected error occurred while shipping.”
When I paste the url from $urlWW into a browser, it works. What is going wrong?
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a se
nd.
At line:1 char:13
+ Invoke-WebRequest -UseBasicParsing -Uri $uriWW | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [I
nvoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.Inv
okeWebRequestCommand
The previous was a translation of an automated translation that was send in the catch.
Without the validation callback:
It works!!! Thx
In previous attempts I had only (Tls11,) Tls12 as security protocols. It doesn’t work. When I added Ssl3 and Tls, I added the validation callback at the same time.
Via the browser
I use the standard settings in the browser. So no proxy and I think no TLS inspection bypass either.