NuGet Behind Proxy
If you are in a network, which uses proxy, you may get below error while executing commands which uses nuget (like dotnet add package):
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
To prevent this error, first be sure that you can execute nuget command in a console. If you get below error, that means nuget.exe does not exists on your computer on it's in another directory.
'nuget.exe' is not recognized as an internal or external command, operable program or batch file.
If nuget.exe is in another directory, you can switch that directory with change directory (for ex.:"cd c:\examplenugetdirectory").
If nuget.exe does not exists on your computer, you can install it from this link.
Then you can execute below links:
nuget.exe config -set http_proxy=http://my.proxy.address:port
nuget.exe config -set http_proxy.user=mydomain\myUserName
nuget.exe config -set http_proxy.password=mySuperSecretPassword
Above commands, will change NuGet.config file under "%appdata%\NuGet" directory.
For extra information, you can visit this link on Microsoft.com.
Special thanks to arcain for his detailed information on StackOverflow.
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
To prevent this error, first be sure that you can execute nuget command in a console. If you get below error, that means nuget.exe does not exists on your computer on it's in another directory.
'nuget.exe' is not recognized as an internal or external command, operable program or batch file.
If nuget.exe is in another directory, you can switch that directory with change directory (for ex.:"cd c:\examplenugetdirectory").
If nuget.exe does not exists on your computer, you can install it from this link.
Then you can execute below links:
nuget.exe config -set http_proxy=http://my.proxy.address:port
nuget.exe config -set http_proxy.user=mydomain\myUserName
nuget.exe config -set http_proxy.password=mySuperSecretPassword
Above commands, will change NuGet.config file under "%appdata%\NuGet" directory.
For extra information, you can visit this link on Microsoft.com.
Special thanks to arcain for his detailed information on StackOverflow.
Yorumlar