linux - dotnet restore 在配置了代理的 bitbucket 管道上失败

标签 linux proxy .net-core nuget-package-restore bitbucket-pipelines

我将通过我的远程主机路由来自正在运行的管道的所有流量。不幸的是,当进程遇到 dotnet restore 时,它会失败。我有关于代理问题的想法,但所有的东西都在片刻之前工作得很好。请指引我走向正确的方向。


这里是环境

bibucket-pipeline.yml 文件:

image: microsoft/dotnet:2.1-sdk
pipelines:
  default:
    - step:
        caches:
          - dotnetcore
        script:
          - curl https://api.ipify.org
          - ssh -fN -C -4 -D 41337 user@remotehost
          - export http_proxy='socks5://localhost:41337'
          - export https_proxy='socks5://localhost:41337'
          - curl https://api.ipify.org
          - dotnet restore
          - dotnet build
          - dotnet test

dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.302
 Commit:    9048955601
Runtime Environment:
 OS Name:     debian
 OS Version:  9
 OS Platform: Linux
 RID:         debian.9-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.302/
Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0
.NET Core SDKs installed:
  2.1.302 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

错误:

/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [/opt/atlassian/pipelines/agent/build/PCT.sln]

/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Only the 'http' scheme is allowed for proxies. [/opt/atlassian/pipelines/agent/build/PCT.sln]

最佳答案

到现在(12 月 18 日),dotnet restore 仍然不支持 socks5 代理。请改用 HTTP 代理。

我使用 privoxy 将 socks5 代理流量转换为 http 代理。

关于linux - dotnet restore 在配置了代理的 bitbucket 管道上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51801200/

相关文章:

java自动代​​理配置

c# - RestSharp 忽略 .NET Core 上的系统代理(例如 Fiddler)

.net-core - .NET Core : How to create solution folders from the command line

linux - 无法在 OSX Yosemite 上启动 docker

linux - 在 Ubuntu 主机上运行 Ubuntu Docker 镜像是否比在任何其他操作系统上运行相同的 Docker 镜像运行得更快?

linux - Internet Explorer 应用程序兼容性 VPC 图像 sha256sums

mysql - 无法在 .NET Core 上使用 MiniProfiler 分析 MySQL

linux - 是否有可能 "transfer"正在运行的应用程序到另一个终端/用户?

java - 从 WebSphere 中的请求获取客户端 IP 地址

node.js - 网络代理阻止socket.io