Visual Studio 2015/2017 本地 NuGet 提要 HTTP 403

Visual Studio 2015/2017 local NuGet feed HTTP 403

我们使用 Nuget.Server 创建了本地 NuGet 提要。这是一个简单的 ASP.NET 应用程序,托管在属于我们本地公司网络的 IIS Web 服务器上。

提要的 url 如下所示:

https://abc.company.com/packages/nuget

启用ISS认证如下:

.NET 授权如下所示:

如果我用 Postman 或 Fiddler 调用上述提要 url,我会得到以下响应:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<service xml:base="https://abc.company.com/packages/nuget/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
    <workspace>
        <atom:title>Default</atom:title>
        <collection href="Packages">
            <atom:title>Packages</atom:title>
        </collection>
    </workspace>
</service>

如果我现在在 Visual Studio NuGet 包源中添加 URL: 然后选择新创建的包源出现以下屏幕,我在其中输入我的域凭据 (domain\user),但没有任何反应:

如前所述,当我使用任何浏览器(IE、Chrome、Edge)访问该站点时,我不必输入我的凭据并且 Fiddler/Postman 也不需要任何凭据。

在 VS PackageManager 输出中,我收到以下错误消息:

[Local] The V2 feed at 'https://abc.company.com/packages/nuget/Search()?$filter=IsAbsoluteLatestVersion&searchTerm=''&targetFramework='net462'&includePrerelease=true&$skip=0&$top=26' returned an unexpected status code '403 Forbidden ( The server denied the specified Uniform Resource Locator (URL). Contact the server administrator.  )'.

当我使用浏览器调用此 URL 时,我没有收到任何错误。

这个设置有什么问题?

问题是我们公司代理导致的,打开内部站点时也考虑到了这个问题。所以我添加了以下环境变量:

NO_PROXY

作为价值我添加了公司内部域名:

NO_PROXY = "abc.company.com"

不,它在本地和我们的构建代理上都有效。

对于我的情况,我必须在 IIS SSL Settings

中禁用 SSL Require