Nuget connection attempt failed "Unable to load the service index for source"

Deleting %AppData%\Roaming\NuGet\NuGet.Config and restarting VS2019 worked for me.

Similar to https://github.com/NuGet/Home/issues/3281


A developer of the nuget-package manager suggested in 2019 to disable tls 1.3 as a workaround (see issue 7705).

Open Registry Editor by pressing Win + R and type regedit Enter

Navigate to:

\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client

Change the value of DisabledByDefault key 0 to 1

Then restart the Visual Studio.

Read more about TLS on wikipedia
Read more about issue 7705 w.r.t. NuGet at github

3rd party edit

Be aware that this disables tls 1.3 for the os not just for nuget or dotnet.
Windows 10 version 1909 did contain an experimental implementation of TLS 1.3 but later versions should be fine. Based on one answer from Unable to browse nuget packages you can test if tls is the problem via a console programm

static async Task Main(string[] args)
{
    var client = new HttpClient();
    string uri = "https://apiint.nugettest.org/v3-index/index.json";
    var response = await client.GetAsync(uri);
    string msg = "If you see this, your machine has no TLS/SSL issues with nuget.org";
    Console.WriteLine(msg);

}

You need to add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings.