2013-06-06 27 views
4

我使用VS 2010(軟件包管理器控制檯)下載NuGet(2.5.40416.9020/Latest)軟件包。它使用URL https://nuget.org/api/v2/。它給我錯誤如下。NuGet在通過Visual Studio下載軟件包時使用的端口

Install-Package : An error occurred while loading packages from'https://nuget.org/api/v2/': The remote name could not be resolved: 'nuget.org' 
At line:1 char:16 
+ Install-Package <<<< Rx-Main 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand 

但是,當我通過瀏覽器訪問相同的URL,然後我能夠瀏覽該網站。 我在公司網絡上,因此防火牆可能會阻塞端口(80和443以外)。

那麼NuGet在通過軟件包管理器控制檯(VS 2010)下載軟件包時使用哪個端口?

回答

4

https://nuget.org/api/v2/意味着端口443(標準的HTTPS端口)

如果你是一個企業網絡上,80和443端口通常是通過代理服務器反彈。

很可能,NuGet由於某種原因未使用您的代理服務器設置,因此無法找到代理服務器並被企業防火牆阻止。

+0

但443在防火牆上沒有被阻止,我可以瀏覽https://nuget.org/網站,但是當我通過軟件包管理器控制檯運行命令時,它給了我錯誤。 – vijay

+0

@vijay我很確定你使用的瀏覽器有一個代理集,而NuGet沒有自動選擇這些設置。有一個例子[這裏](http://stackoverflow.com/questions/9232160/nuget-behind-proxy)關於如何爲NuGet 1.4或更高版本設置代理設置。 –

+0

感謝@Joachim的回覆。我已經設置了代理地址。但是現在我得到新的錯誤。 '遠程服務器返回錯誤:(502)Bad Gateway'。 – vijay

3

轉到文件計劃Files \ Microsoft Visual Studio的14.0 \ Common7 \ IDE \ devenv.exe.config

Set ipv6 enabled from true to false 

 <system.net> 
      <settings> 
       <ipv6 enabled="false"/> 
      </settings> 
     </system.net> 
+0

這不適合我。 –

1

我無法通過控制檯下載金塊包,它發生如下錯誤:

"Unable to connect remote server"

我按照上面的步驟和Set ipv6 enabled從true到false。它解決了我的問題。

C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config 

<system.net> 
    <settings> 
     <ipv6 enabled="false"/> 
    </settings> 
</system.net> 
相關問題