2012-07-19 731 views
51

在MS Visual Studio中,我试图将Nuget软件包安装到我的解决方案中。Visual Studio/C#:Nuget无法连接到远程服务器

当我选择“管理解决方案的Nuget包”选项并尝试安装包时,我收到消息“无法连接到远程服务器”。

我确实有互联网连接,所以不明白为什么我总是收到这条消息。

有没有人知道可以采取一些措施来纠正这个问题?

谢谢

+1

您使用的是哪个版本的NuGet? – 2012-07-19 15:33:33

+0

你在代理的背后吗? – 2012-07-19 17:00:09

+0

其版本2.0.30619.9119。 我不相信我是代理的背后,我可以在我的浏览器上访问nuget.org没有问题。 – TheWommies 2012-07-20 03:31:48

回答

43

清除HTTP_PROXY为我工作。

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.

http://support.microsoft.com/kb/2289942感谢@Sandy

+28

你在哪里做的? – Svish 2014-01-13 15:55:20

+17

导航到http://support.microsoft.com/kb/2289942并搜索'让我自己修复它'。顺便说一句,这个答案解决了我的问题,现在我配得上述评论的所有14个赞扬:-P – Sandy 2014-09-16 13:38:20

+0

@Sandy的确保存我的一天..谢谢 – 2015-03-20 17:15:02

-1

Internet属性 - >局域网设置 - >取消勾选 “自动检测设置”

+0

这将有助于你包括为什么这应该工作,以及这个菜单的生活。 – vossad01 2013-04-21 17:33:08

11

工具 - >库包管理器 - >软件包管理器设置 - >清除包缓存

这为我工作

0

我有同样的症状,显然视觉工作室使用一些代理服务器设置集在IE中。原来,我的问题是下列之一:

  • 我的IE浏览器已经更新到IE 9,但未完成更新,因为我还没有完成“更新向导”
  • 有些晦涩代理设置设置在IE(一个硒RC测试运行的残余)

完成更新向导,并清除所有代理设置后,我的NuGet包管理器再次工作。

37

已解决。那是因为Visual studio正在使用fiddler http连接。

您只需打开fiddler => fiddler option => connection =>取消选中“作为启动时的系统代理”。

这就是所有!

+0

谢谢!在生效之前,我也必须关闭小提琴手,或者可能会有短暂的延迟。 – 2016-03-31 12:35:22

+0

我试过这个,但仍然得到github.com的错误,这似乎与nuget.org问题类似。 – Nate 2016-10-25 14:30:31

1

即使将Nuget Package Manager更新到最新版本,并且也可以取消选择所有包源,我在VS 2010包恢复中遇到了此问题。在解决方案上启用Nuget Package Restore选项时出现错误。

我通过使用不具有受限制的https访问nuget服务器的框来解决此问题。当我使用VS 2012从另一个盒子启用包恢复时,它工作正常。我相信它需要能够连接到nuget在线服务器以下载恢复操作期间使用的最新nuget.exe。因此,您可以使用的一个选项是从必须具有所有Internet访问权限的服务器执行“启用软件包还原”过程,然后签入更改。一旦这些更改签入,您就可以再次从VS 2010或VS 2012加载解决方案,并使用nuget恢复功能。

希望有帮助!

21

今天在Visual Studio 2012上开始发生这种事情。有点简单,但是,检查是否的NuGet网站本身并试图软件包管理器控制台后,我的解决办法是:

关闭并重新打开Visual Studio的

突然它可以连接到的NuGet服务器再次并下载我急需的软件包。

+4

...当有疑问重新启动视觉工作室。应该知道ಠ_ಠ – 2014-09-08 14:37:56

+1

所有事实的母亲......感觉有福:) – wonderbell 2015-06-09 06:20:04

+1

这可能与我的问题有关github.com以及 http://stackoverflow.com/questions/39129434/github-extension-for- visual-studio-2015-lose-connection – Nate 2016-10-25 11:35:48

0

有同样的问题,这是解决方案的具体情况,并没有上述工作。我删除了Visual Studio解决方案用户选项文件(.suo)并重新启动VS 2013,现在我可以再次更新和安装软件包。

0

终于解决了。我禁用了Chrome中的扩展程序。我已经安装它来隐藏我的真实位置。

4

我解决它在我的注释掉从位于

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

这是最终为我工作的解决方案。删除.user文件将暂时工作,但它总是会回来。 system.net部分有一个似乎尝试使用IPv6的设置,因此注释掉此部分将禁用该设置。 – Bela 2015-07-07 15:25:29

+0

为什么你认为它涉及* devenv.exe *但事实上,你可以使用浏览器测试连接到“https:// api.nuget.org/v3/index.json”,因此无论VS如何连接到这里。您的计算机上安装的浏览器应该不知道该配置文件。这里的问题在某种程度上阻止了地址,使用代理可以帮助连接到该地址。 – 2018-01-06 20:14:45

0

devenv.exe.config

<system.net></system.net> 

部分要重置您的Internet Explorer代理设置自己,请按照下列步骤操作:1.On的Windows XP中,单击开始,或者在Windows Vista或Windows 7上,单击

2459687,然后单击运行。在Windows 8或Windows 8.1上,要访问运行命令,请按Windows徽标键

Windows徽标键+ R.或者,从屏幕右边缘向内轻扫,然后点击搜索(或者如果您正在使用鼠标指向屏幕的右上角,向下移动鼠标指针,然后单击搜索)。在搜索框中键入运行,然后点击或单击运行。 2.在运行文本框中,复制(CTRL + C)并粘贴(CTRL + V)或键入以下内容:

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

3.单击确定。 4.在Windows XP中,单击开始,或在Windows Vista或Windows 7上,单击

2459687,然后单击运行。在Windows 8或Windows 8.1上,要访问运行命令,请按Windows徽标键

Windows徽标键+ R.或者,从屏幕右边缘向内轻扫,然后点击搜索(或者如果您正在使用一个鼠标,指向屏幕的右上角,向下移动鼠标指针,然后单击搜索)。在搜索框中键入运行,然后点击或单击运行。 5.在运行文本框中,复制(CTRL + C)并粘贴(CTRL + V)或键入以下内容: reg删除“HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings”/ v ProxyServer/f

6.单击确定。

5

清除IE中的代理缓存修复了这个问题。请在命令提示符下运行这些两个命令行(以管理员身份运行)

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

然后

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

细节可以在https://support.microsoft.com/en-us/kb/2289942

+0

这适用于我,但是第二行返回: “错误:系统无法找到指定的注册表项或值。” – 2015-05-29 09:12:42

+0

@DamianGreen这不是一个问题,它只是删除你不想要的条目,如果它在那里。如果不是,你会看到这个消息,并且没有必要担心。我很高兴它为你工作! – 2015-05-29 10:13:47

-2

步骤中找到:

  1. 关闭提琴手。
  2. 重新启动Visual Studio。
0

我无法安装全球化的V.S. 2015年,并尝试所有的答案,我试过这个。我在V.S.开了我的项目。 2013年,它第一次运作。希望这可以帮助别人

0

调制解调器重新启动修复了我的问题。

3

以下是我固定的这个问题没有任何的上述建议后,工作:

的Internet Explorer>工具>连接>局域网设置
取消选中“自动检测设置”框。这为我解决了Nuget Package Manager问题。此外,它还修复了我在VMWare虚拟桌面上遇到的另一个连接问题,并且它在尝试连接到安全站点时大大提高了Internet Explorer的速度。