Visual Studio/C#: Nuget Unable to connect to remote server

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

In MS Visual studio, I'm trying to install Nuget packages into my solution.

When I choose the option "Manage Nuget Packages for Solution" and attempt to install a package, I get the message "Unable to connect to the remote server".

I do have Internet connection so do not understand why I always get this message.

Is anyone aware of some steps that can be taken to rectify this issue?

Thanks

回答1:

Clearing HTTP_PROXY worked for me.

Let me fix it myself

Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: 322756 How to back up and restore the registry in Windows

To reset your Internet Explorer proxy settings yourself, follow these steps:

  1. On Windows XP, click Start, or on Windows Vista or Windows 7, click , and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key Windows logo key + R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run.
  2. In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following: reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
  3. Click OK.
  4. On Windows XP, click Start , or on Windows Vista or Windows 7, click , and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key Windows logo key + R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run.
  5. In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following: reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f
  6. Click OK.

From http://support.microsoft.com/kb/2289942 Thanks @Sandy



回答2:

Solved. that's because Visual studio is using fiddler http connection.

all you have to do is to open fiddler=> fiddler option => connection => uncheck "act as system proxy on startup".

thats all!



回答3:

This started happening to me quite randomly today on Visual Studio 2012. A bit simplistic but, after checking if the Nuget site itself was up and trying the Package Manager Console, my solution was to:

Close and reopen Visual Studio

Suddenly it could connect to the Nuget server again and download my much needed packages.



回答4:

Tools -> Library Package Manager -> Package Manager Settings -> Clear Package Cache

That worked for me



回答5:

Clearing the Proxy Cache in IE Fixed this for me. Use these two command lines in the command prompt (run as administrator)

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f 

then

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f 

The details can be found at https://support.microsoft.com/en-us/kb/2289942



回答6:

I solved it on mine by commenting out the

section from the devenv.exe.config located at

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config 


回答7:

Here's how I fixed this issue after none of the suggestions above worked:

Internet Explorer > Tools > Connections > Lan Settings
Uncheck 'Automatically Detect Settings' box. This solved the Nuget Package Manager issue for me. Additionally it fixed another connectivity problem I was having with a VMWare virtual desktop AND... it greatly increased speed in Internet Explorer when trying to connect to secure sites.



回答8:

I had this issue with VS 2010 package restore even after updating the Nuget Package Manager to the latest and also unselecting all package sources I could. I was getting an error while enabling the Nuget Package Restore option on the solution.

I resolved this by using a different box that didn't have restricted https access to the nuget server. When I used VS 2012 from a different box to enable package restore, it worked fine. I believe it needs to be able to connect to the nuget online server to download the latest nuget.exe used during restore operations. So one option you can use is to perform the Enable Package Restore process from a server that has all the internet access necessary, and then check-in the changes. Once these changes are checked-in, you can then load the solution again from VS 2010 or VS 2012 and use the nuget restore capabilities.

Hope that helps!



回答9:

I had the same symptoms, and apparently visual studio was using some proxy setting set up in IE. It turned out that my problem was one of the following:

  • My IE had been updated to IE 9, but the update wasn't completed because I hadn't completed the 'update wizard'
  • Some obscure proxy setting was set up in IE (a remnant of a selenium RC test run)

After completing the update wizard, and clearing all proxy settings, my NuGet package manager was working again.



回答10:

Had the same issue, it was solution specific, and none of the above worked. I deleted the visual studio solution user options file (.suo) and restarted VS 2013 and now I can update and install packages again.



回答11:

Finally resolved. I disabled an extension in Chrome. I had installed it to hide my real location.



回答12:

To reset your Internet Explorer proxy settings yourself, follow these steps:1.On Windows XP, click Start, or on Windows Vista or Windows 7, click

2459687, and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key

Windows logo key+ R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run. 2.In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following:

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

3.Click OK. 4.On Windows XP, click Start , or on Windows Vista or Windows 7, click

2459687, and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key

Windows logo key + R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run. 5.In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following: reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f

6.Click OK.



回答13:

i could not install globalize in V.S. 2015 and after trying all the answers i tried this. I opened my project in V.S. 2013 and it worked 1st time. hope this helps somebody else



回答14:

Modem re-start fixed my problem.!



回答15:

Internet Properties -> LAN Settings -> uncheck "Automatically detect settings"



回答16:

Steps:

  1. Close Fiddler.
  2. Restart Visual Studio.


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!