Hi,
Since yesterday, at least, we are getting this error when running (New-Object System.Net.WebClient).DownloadString("https://dot.net/v1/dotnet-install.ps1") > dotnet-install.ps1 or wget https://dot.net/v1/dotnet-install.ps1 from a docker container under microsoft/dotnet-framework:4.7.2-sdk, this has also been reproduced under a current Windows 10 Desktop install.
Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error occurred on a send."
At line:1 char:1
+ (New-Object System.Net.WebClient).DownloadString("https://dot.net/v1/ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
Accessing from a browser works as expected.
Will this be fixed. What can we do in the meantime?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
In my experience this is because of the combination of TLS 1.2 requirement on the website and PowerShell. This explains: https://www.codyhosterman.com/2016/06/force-the-invoke-restmethod-powershell-cmdlet-to-use-tls-1-2/ And this sample above shows how to do this from PowerShell: @powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) <additional install-script args>"
Just noticed this: https://github.com/dotnet/docs/issues/5153
I see, thank you. We have used a compiled curl in the meantime. Do you think Powershell will upgrade to 1.2 as default in the following months? The dotnet-install.ps1 script in itself does not seem to fail currently.
@KathleenDollard @johnbeisner can you please comment?
@johnbeisner Will this continue to be a problem going forward?
Met with @johnbeisner today about this. There's not much we can do since this is a constraint from the environment you run the script. Hopefully the workaround to force PS to use TLS 1.2 provided by @MikkelHegn can help in this scenario.
In my experience this is because of the combination of TLS 1.2 requirement on the website and PowerShell. This explains: https://www.codyhosterman.com/2016/06/force-the-invoke-restmethod-powershell-cmdlet-to-use-tls-1-2/ And this sample above shows how to do this from PowerShell:
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) <additional install-script args>"
Thanks ,it's working
Even without TLS using https, I get this error. Anyone faced the same?
@yehgdotnet me too the problem i am facing is
The splatting operator '@' cannot be used to reference variables in an expression. '@powershell' can be used only as an
argument to a command. To reference variables in an expression use '$powershell'.
At line:1 char:12
+ @powershell <<<< -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [N
et.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps
1'))) <additional install-script args>"@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePoint
Manager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https
://dot.net/v1/dotnet-install.ps1'))) <additional install-script args>"
+ CategoryInfo : ParserError: (powershell:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : SplattingNotPermitted
Most helpful comment
In my experience this is because of the combination of TLS 1.2 requirement on the website and PowerShell. This explains: https://www.codyhosterman.com/2016/06/force-the-invoke-restmethod-powershell-cmdlet-to-use-tls-1-2/ And this sample above shows how to do this from PowerShell:
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) <additional install-script args>"