3

我们刚刚开始遇到 Nuget 的问题。我们可以获得一个包列表,但是当我们尝试安装某些包(如 jQuery)时,我们会收到 403(禁止访问)错误。我相信我们的代理 (McAfee) 阻止了某些 URL。

这似乎与此问题中描述的问题相同。他们使用 Wireshark 解决了这个问题。我不能使用 Wireshark,因为(你猜对了)它在这里被阻止了。

这个另一个问题提到去https://nuget.org/api/v2/但是当我这样做时,我只看到大约 8 行 XML。

所以我的问题是:我怎样才能看到 Nuget 提要的 URL,以便我可以请求我们的网络人员在不使用 Wireshark 或 Fiddler 的情况下取消阻止它?

4

1 回答 1

10

Install the command-line nuget.exe client from https://nuget.org/nuget.exe

Then run nuget sources to view the registered endpoints. This will typically list something like this:

D:\>nuget sources
Registered Sources:

1.  https://nuget.org/api/v2/ [Enabled]
    https://nuget.org/api/v2/

From this you can see the base endpoints which are likely being used within Visual Studio or the PS tools.

You can also use an HTTP inspector like Fiddler to capture the exact calls from the nuget client (whether command-line or Visual Studio) to the nuget.org endpoint, resulting in something like this:

Fiddler2 sniffing HTTPS traffic from nuget.exe to nuget.org

In the 'Process' column you can see the calls originating from nuget.exe. To see the exact URLs you can configure Fiddler to intercept and decrypt HTTPS, or alternatively specify a non-HTTPS Source like this nuget list log4net -Source http://nuget.org/api/v2/ which results in Fiddler being able to see the plain HTTP responses:

Fiddler2 sniffing HTTP traffic from nuget.exe to nuget.org

In this case, one of the calls from nuget.exe was:

GET http://www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=Id&$skip=0&$top=30&searchTerm='log4net'&targetFramework=''&includePrerelease=false HTTP/1.1

The nuget clients make several calls to retrieve even just a package list but AFAIK, the calls are all standard HTTP GET, POST, etc., not WebDAV calls, so there should be no reason why these calls should not work with a proxy as long as the nuget.org site itself is not blocked.

于 2013-08-11T13:00:50.507 回答