I'm trying to build an ASP.NET Core MVC application cloned from GitHub on my Windows 11 machine using WSL and PowerShell. But whenever I run dotnet restore or try to build, I get this error:
Error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json.
Also, running
curl https://api.nuget.org/v3/index.json
results in:
curl: (35) Recv failure: Connection was reset
What I've tried so far:
Disabled Windows Defender firewall (public, private, domain).
Checked WinHTTP proxy settings with
netsh winhttp show proxy— it says Direct access (no proxy).Tested the same curl command inside WSL, Git Bash, PowerShell — all give the same connection reset error.
Updated Windows from Home to Pro (dummy key) to rule out edition issues.
Tried forcing TLS 1.2 in PowerShell with:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest https://api.nuget.org/v3/index.json
But the connection was forcibly closed by the remote host.
Connected to a mobile hotspot (different network) — same error.
Temporarily removed and re-added NuGet sources, including adding an HTTP (non-secure) NuGet source to test.
What helped me narrow down the issue: the connection reset error happens system-wide, not just inside WSL or specific shells.
This almost always indicates some security software (antivirus or endpoint protection) is intercepting or blocking HTTPS traffic to NuGet servers.
Disabling or uninstalling antivirus software (Kaspersky, BitDefender, Avast, etc.) is the most common fix.
Network-level filtering (ISP or router) is unlikely since mobile hotspot connection also fails.
Proxy settings are clean.
The official NuGet HTTPS source is accessible from other machines.
Summary:
If you see error NU1301 and connection reset errors when accessing https://api.nuget.org/v3/index.json, try:
Disabling/uninstalling your antivirus or endpoint protection.
Checking for any proxies with netsh winhttp show proxy.
Testing on a different network (mobile hotspot).
Verifying firewall settings.
Final question: has anyone faced similar HTTPS connection resets with NuGet? What antivirus or security software caused this in your case, and how did you fix it? Any tips for safely re-enabling antivirus after fixing this?