Nuget connection attempt failed "Unable to load the service index for source"
回答1Deleting %AppData%\Roaming\NuGet\NuGet.Config
and restarting VS2019 worked for me.
Similar to https://github.com/NuGet/Home/issues/3281
回答2
I was getting the same error while trying to browse the NuGet Package, to resolve the same followed below step:
1- go to %appdata%\NuGet\NuGet.config
2- Verify the urls mentioned in that config
3- Remove the url which is not required
4- Restart visual studio and check
回答3
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);
}
StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Pragma: no-cache
Cache-Control: no-cache
P3P: CP="CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOC CNT"
WWW-Authenticate: Bearer authorization_uri=https://login.windows.net/4c1d9e0f-5c27-4228-a35a-de7b4083ff7b
WWW-Authenticate: Basic realm="https://pkgsprodsea1.pkgs.visualstudio.com/"
WWW-Authenticate: TFS-Federated
X-TFS-ProcessId: 6fc8918c-f900-4df8-964a-f30dc645a292
Strict-Transport-Security: max-age=31536000; includeSubDomains
ActivityId: 03bc0847-be61-42c4-b77e-29887273a4a5
X-TFS-Session: 03bc0847-be61-42c4-b77e-29887273a4a5
X-VSS-E2EID: 03bc0847-be61-42c4-b77e-29887273a4a5
X-VSS-SenderDeploymentId: c2de059f-04a4-1d6b-3b8b-c264075f8958
X-FRAME-OPTIONS: SAMEORIGIN
X-TFS-FedAuthRealm: https://pkgsprodsea1.pkgs.visualstudio.com/
X-TFS-FedAuthIssuer: https://www.visualstudio.com/
X-VSS-AuthorizationEndpoint: https://vssps.dev.azure.com/edenred-itec-rdc/
X-VSS-ResourceTenant: 4c1d9e0f-5c27-4228-a35a-de7b4083ff7b
X-VSS-S2STargetService: 00000030-0000-8888-8000-000000000000/visualstudio.com
X-TFS-FedAuthRedirect: https://spsprodea1.vssps.visualstudio.com/_signin?realm=pkgs.dev.azure.com&reply_to=https%3A%2F%2Fpkgs.dev.azure.com%2Fedenred-itec-rdc%2F_packaging%2FEdenred.Rdc%2Fnuget%2Fv3%2Findex.json&redirect=1&hid=49cf9e98-b607-4f1d-9453-1b716e1de413&context=eyJodCI6MiwiaGlkIjoiMGZlMjIyNjAtYjkwZS00ZDVhLTk1N2ItZmM4MGNkOWE0NThhIiwicXMiOnt9LCJyciI6IiIsInZoIjoiIiwiY3YiOiIiLCJjcyI6IiJ90#ctx=eyJTaWduSW5Db29raWVEb21haW5zIjpbImh0dHBzOi8vbG9naW4ud2luZG93cy5uZXQiXX01
Request-Context: appId=cid-v1:44bb2f7d-18d2-472b-b6db-4777a144596c
Access-Control-Expose-Headers: Request-Context
X-Content-Type-Options: nosniff
X-Cache: CONFIG_NOCACHE
X-MSEdge-Ref: Ref A: 77AECA4794C044CDB2EFA45D9AF82B66 Ref B: TYBEDGE0520 Ref C: 2022-09-27T03:38:26Z
Date: Tue, 27 Sep 2022 03:38:27 GMT
Content-Length: 343
Content-Type: application/json; charset=utf-8
Expires: -1
}
标签:load,index,attempt,NuGet,https,visualstudio,com,TFS From: https://www.cnblogs.com/chucklu/p/16734009.html