docker容器中的dotnet还原期间出错
我正在尝试运行.NET核心dockerfile,但在dotnet还原中不断出现错误。我正在Linux容器中运行它。我尝试在Windows容器中运行它,但在执行COPY命令时出错 我有一个docker compose文件,它从子文件夹加载.NET Core dockerfile。我在Powershell中运行“docker compose up”。生成过程进入dotnet还原步骤并抛出以下错误:docker容器中的dotnet还原期间出错,docker,.net-core,dockerfile,Docker,.net Core,Dockerfile,我正在尝试运行.NET核心dockerfile,但在dotnet还原中不断出现错误。我正在Linux容器中运行它。我尝试在Windows容器中运行它,但在执行COPY命令时出错 我有一个docker compose文件,它从子文件夹加载.NET Core dockerfile。我在Powershell中运行“docker compose up”。生成过程进入dotnet还原步骤并抛出以下错误: /usr/share/dotnet/sdk/3.1.100/NuGet.targets(123,5):
/usr/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Unable to load the service index for source http://192.168.30.2:8080/tfs/DefaultCollection/_packaging/api-library/nuget/v3/index.json. [/Portal.API/Portal.Api.csproj]
/usr/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : GSSAPI operation failed with error - Unspecified GSS failure. Minor code may provide more information (SPNEGO cannot find mechanisms to negotiate). [/Portal.API/Portal.Api.csproj]
我尝试根据以下Stackoverflow帖子在Visual Studio中更新devenv.exe.config文件:
在更新devenv.exe.config之后,我得到了这个稍微不同的错误(还包括整个构建输出):
更新:我的一些NuGet软件包托管在本地网络上的私有服务器上,我通过VPN访问该服务器。我使用Windows Active Directory登录到我的工作笔记本电脑,我认为这些凭据用于访问专用服务器
更新2:我将登录凭据添加到我的NuGet.config中,如下所示:
...
<packageSourceCredentials>
<api-library>
<add key="Username" value="username" />
<add key="ClearTextPassword" value="password" />
</api-library>
</packageSourceCredentials>
</configuration>
在做了更多的谷歌搜索之后,我想我需要以不同的方式传递登录凭据,可能需要使用个人访问令牌,如GitHub帖子中所示:
我不知道该怎么办 我通过使用Windows容器解决了这个问题。您的项目是否依赖于由
192.168.30.2:8080上的私有NuGet服务器托管的NuGet包?看起来nuget正试图从容器内部访问该服务器,但无法访问。(我不是Docker网络能手,所以我不确定这是否是预期的)它说连接被拒绝,所以这不是从容器内部接触的问题。从他连接到它的任何地方,在192.168.30.2
的端口8080
上都没有监听内容。你可以用telnet 192.168.30.28080来确认。是的,它是一个托管在我工作的本地网络上的专用服务器。我通过VPN访问它。@mdailey77我也在尝试处理同样的情况。有什么对你有用吗?@lquery我忘了这个问题。我切换到Windows容器,而dotnet恢复工作正常。
...
<packageSourceCredentials>
<api-library>
<add key="Username" value="username" />
<add key="ClearTextPassword" value="password" />
</api-library>
</packageSourceCredentials>
</configuration>
/usr/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : Unable to load the service index for source http://192.168.30.2:8080/tfs/DefaultCollection/_packaging/api-library/nuget/v3/index.json. [/Portal.API/Portal.Api.csproj]
/usr/share/dotnet/sdk/3.1.100/NuGet.targets(123,5): error : GSSAPI operation failed with error - An invalid name was supplied (Configuration file does not specify default realm).