I am doing container-based builds of my Sitecore solution, based on examples provided by Sitecore. However when I attempt to build, I get the following error:

RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"
 ---> Running in 99e111499461
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure

I can invoke this command successfully from my Docker host. How can I resolve this error, and what is the cause?

2 Answers 2


Quick Fix

Search your solution for any references to the Docker image tag mcr.microsoft.com/dotnet/framework/sdk:4.8 and replace them with mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019.


Many of the examples provided by Sitecore use .NET Framework SDK images provided by Microsoft as a base for solution builds. When the Microsoft image tags do not contain an OS version, they are often actually references to a manifest associated with the tag to determine the actual image that will be used, based on the OS version of the Docker host.

You can see the available OS images associated with a manifest with the docker manifest inspect command.

docker manifest inspect mcr.microsoft.com/dotnet/framework/sdk:4.8

If Microsoft does not have an SDK image for your exact Windows version (perhaps you are using a new or old SAC release), you may end up with LTSC2016, which does not have TLS 1.2 enabled, thus the TLS error downloading NuGet.exe.

You can see the Windows version of the image actually being used in your Docker host via docker image inspect.

docker image inspect mcr.microsoft.com/dotnet/framework/sdk:4.8 --format '{{ .OsVersion }}'

In the output above, 10.0.14393 would indeed indicate use of LTSC2016.


I used to fix this one by adding TLS 1.2 support to each Invoke-WebRequest command:

RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
    Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"

doesn't this work for you?

  • Indeed this would probably work. However it worked fine without this previously. Commented Aug 26, 2021 at 13:00
  • 2
    It does indeed resolve the problem. But there could be a lot of other unwanted side effects from unexpectedly running against ltsc2016 base images over ltsc2019
    – Mark Cassidy
    Commented Sep 1, 2021 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.