【发布时间】:2019-08-30 14:39:06
【问题描述】:
我是 Visual Studio 和 NuGet 的新手,我遇到了这个错误。
我不知道我做错了什么你能帮帮我吗?
这是我的控制台输出:
Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj
Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife.iOS/Pfeife.iOS.csproj
Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife.Android/Pfeife.Android.csproj
Running non-parallel restore.
Reading project file /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj.
Persisting no-op dg to /Users/{USERNAME}/Pfeife/Pfeife/obj/Pfeife.csproj.nuget.dgspec.json
Restoring packages for /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj...
Restoring packages for .NETStandard,Version=v2.0...
GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.
The SSL connection could not be established, see inner exception.
Unable to write data to the transport connection: The socket is not connected.
The socket is not connected
GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.
The SSL connection could not be established, see inner exception.
Unable to write data to the transport connection: The socket is not connected.
The socket is not connected
GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Failed to retrieve information about 'System.Net.Http' from remote source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.
【问题讨论】:
-
看到这个Answer
-
您没有与 :api.nuget.org/v3-flatcontainer/system.net.http/index.json 建立安全连接。使用诸如wireshark 或fiddler 之类的嗅探器并使用标准Webbrowser 捕获第一个请求。然后使用您的 c# 代码捕获相同的结果。将标头添加到您的 c# 代码中,使其看起来像工作结果。
-
@jdweng 我只想添加 System.Net.Http 包这不是我的代码,不是吗?
-
一个 http 请求包含标头。您的标头与服务器不兼容。使用 SSL/TLS 的安全连接可能很糟糕。使用 IE,我可以连接到服务器并查看响应。
-
重新启动 Visaul Studio 修复了它....
标签: c# visual-studio nuget