Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net Nuget连接尝试失败”;无法加载源“”的服务索引;_.net_Visual Studio_Nuget - Fatal编程技术网

.net Nuget连接尝试失败”;无法加载源“”的服务索引;

.net Nuget连接尝试失败”;无法加载源“”的服务索引;,.net,visual-studio,nuget,.net,Visual Studio,Nuget,尝试连接到Nuget时,出现以下错误,然后无法连接: [nuget.org]无法加载源的服务索引 . 发送请求时出错。 无法连接到远程服务器 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立了连接 失败,因为连接的主机未能响应68.232.34.200:443 我可以访问https://api.nuget.org/v3/index.json在我的浏览器上 这个问题不是重复的。其他答案不能解决我的问题。您需要将代理设置添加到Nuget.Config文件中。有关详细信息,请参阅此链接:&。

尝试连接到Nuget时,出现以下错误,然后无法连接:

[nuget.org]无法加载源的服务索引 . 发送请求时出错。 无法连接到远程服务器 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立了连接 失败,因为连接的主机未能响应68.232.34.200:443

我可以访问
https://api.nuget.org/v3/index.json
在我的浏览器上


这个问题不是重复的。其他答案不能解决我的问题。

您需要将代理设置添加到Nuget.Config文件中。有关详细信息,请参阅此链接:&。

您需要将代理设置添加到Nuget.Config文件中。有关详细信息,请参阅此链接:&。

某些开发环境可能既不使用浏览器也不使用代理

一种解决方案是从nugget下载包,比如
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
访问共享目录,然后执行以下操作:

dotnet add package Microsoft.AspNetCore.StaticFiles -s "shared drive:\index.json"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <config>
        <add key="http_proxy" value="http://proxy_hostname_or_ip:3128" />
        <add key="https_proxy" value="http://proxy_hostname_or_ip:3128" />
    </config>

  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>

</configuration> 
我希望这对你有用。

某些开发环境可能既不使用浏览器也不使用代理

一种解决方案是从nugget下载包,比如
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
访问共享目录,然后执行以下操作:

dotnet add package Microsoft.AspNetCore.StaticFiles -s "shared drive:\index.json"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <config>
        <add key="http_proxy" value="http://proxy_hostname_or_ip:3128" />
        <add key="https_proxy" value="http://proxy_hostname_or_ip:3128" />
    </config>

  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>

</configuration> 
我希望这对你有用。

转到

设置(电脑的全局设置)>网络和互联网>代理>自动代理设置>,并将自动检测设置设置设置为关闭

转到


设置(电脑的全局设置)>网络和互联网>代理>自动代理设置>,并将自动检测设置设置设置为关闭

该错误可能是由临时网络问题引起的,如果重试,则会消失。

该错误可能是由临时网络问题引起的,如果重试,则会消失。

为了支持@Eddie Chen()提供的答案,我还必须将http\U代理设置添加到以下文件中:

C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.config

<add key="http_proxy" value="http://your_proxy_url:8080" />

为了支持@Eddie Chen()提供的答案,我还必须将http\U代理设置添加到以下文件中:

C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.config

<add key="http_proxy" value="http://your_proxy_url:8080" />


某些内容可能会更改您的代理设置,如Fiddler。关闭Fiddler,然后关闭Visual Studio并再次打开它。

某些内容可能会更改您的代理设置,例如Fiddler。关闭Fiddler,然后关闭Visual Studio并再次打开它。

在我的
Dockerfile
中运行
RUN dotnet restore
时,在
Windows10
中使用
docker compose up
命令,我遇到了同样的错误

我已经尝试了互联网上提供的所有可能的解决方案,也一直在关注。最后,在花了8个多小时之后,通过遵循前面的步骤,我能够解决我的问题

  • 从系统中卸载
    Docker
  • 重新启动系统
  • 从此安装
    Docker
    。下面是我的Docker版本

  • 重新启动系统

  • 启动Docker for Windows,在Windows的搜索栏中搜索
    Docker
    。确保它正在运行

  • 您还应该转到
    Services.msc
    ,并确保服务
    Docker引擎
    Docker for Windows服务
    正在运行

  • 最后,您必须从
    C:\Users\{Username}\AppData\Roaming\Nuget
    检查您的Nuget.config文件。对我来说,该文件的内容如下

    
    

    希望这有帮助


  • 在我的
    Dockerfile
    中运行
    RUN dotnet restore
    时,使用
    windows10
    中的
    docker compose up
    命令,我遇到了同样的错误

    我已经尝试了互联网上提供的所有可能的解决方案,也一直在关注。最后,在花了8个多小时之后,通过遵循前面的步骤,我能够解决我的问题

  • 从系统中卸载
    Docker
  • 重新启动系统
  • 从此安装
    Docker
    。下面是我的Docker版本

  • 重新启动系统

  • 启动Docker for Windows,在Windows的搜索栏中搜索
    Docker
    。确保它正在运行

  • 您还应该转到
    Services.msc
    ,并确保服务
    Docker引擎
    Docker for Windows服务
    正在运行

  • 最后,您必须从
    C:\Users\{Username}\AppData\Roaming\Nuget
    检查您的Nuget.config文件。对我来说,该文件的内容如下

    
    

    希望这有帮助


  • 我在尝试浏览NuGet包时遇到同样的错误,要解决同样的问题,请执行以下步骤

    1-转到
    %appdata%\NuGet\NuGet.config

    2-验证该配置中提到的URL

    3-删除不需要的url


    4-重新启动visual studio并选中

    我在尝试浏览NuGet软件包时遇到了相同的错误,请按照下面的步骤解决相同的问题

    1-转到
    %appdata%\NuGet\NuGet.config

    2-验证该配置中提到的URL

    3-删除不需要的url


    4-重新启动visual studio并检查

    我在尝试通过Jenkins(默认情况下使用本地系统帐户配置为服务)运行nuget.exe时遇到此问题。我已经编辑了
    C:\Windows\System32\config\systemprofile\AppData\Roaming\NuGet\NuGet.config<
    
    <config>
         <!-- Proxy settings -->
         <add key="http_proxy" value="host" />
         <add key="http_proxy.user" value="username" />
         <add key="http_proxy.password" value="encrypted_password" />
    </config>
    
    DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 dotnet ...
    
      <packageSourceCredentials>
          <vstsfeed>
              <add key="Username" value="yourname@company.com" />
              <add key="Password" value="this is an encrypted password" >
              <!-- add key="ClearTextPassword" value="not recommended password" -->
          </vstsfeed>
      </packageSourceCredentials>
    
    \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client
    
    <defaultProxy enabled="true" useDefaultCredentials="true">
        <proxy bypassonlocal="True" proxyaddress="http://<yourproxy:port#>"/>
    </defaultProxy>
    
    <!--<defaultProxy enabled="true" useDefaultCredentials="true">
        <proxy bypassonlocal="True" proxyaddress="http://<yourproxy:port#>"/>
    </defaultProxy>-->
    
    reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64
    
    reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32
    
    error :   Response status code does not indicate success: 401 (Unauthorized).
    
    reg add HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:32
    reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:64
    reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:32
    reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:64