NuGet is returning 503 Server Unavailable

Talbott Crowell picture Talbott Crowell · Aug 20, 2012 · Viewed 8.3k times · Source

Is there a way to load a package from an alternative server when Visual Studio Package Manager (NuGet) is responding with a "The remote server returned an error: (503) Server Unavailable" message?

Answer

Sixto Saez picture Sixto Saez · Dec 12, 2013

This is an obscure condition that will likely only occur on an "enterprisy" network environment. If these conditions apply you:

  • you are required to access the Internet via an HTTP proxy server

  • the HTTP proxy server requires a valid user ID & password (or AD authentication) to allow requests to proceed

  • you've been messing with cool developer tools that were ported to Windows from a Linux/Unix environment

  • the new cool tool(s) work after adding the HTTP_PROXY (or possibly HTTPS_PROXY or both) environment variable(s)

  • you can access the NuGet servers from a browser without getting a 503 error

Then it's likely you broke NuGet by inadvertently invoking this configuration feature. I'm not sure exactly how the environment variable breaks NuGet but I suspect NuGet is detecting & using the http_proxy URL but sending an empty user ID & password which causes the HTTP proxy to reject the request.

Fix: remove the environment variable(s) you added and see if the cool tool can be configured to use an HTTP proxy without them.

Update: Ran into a version of this issue with the NuGet config file referenced in the "this configuration feature" link above. Open this file:

%appdata%\nuget\nuget.config

in your favorite editor. If it contains elements with http_proxy or https_proxy then removing these elements may fix the issue too.

PS: Hopefully I'll get an up vote from Colonel Panic :-)