【问题标题】:TFS vNext build agent fails with 407 proxy authentication errorTFS vNext 构建代理失败,出现 407 代理身份验证错误
【发布时间】:2016-01-28 16:42:48
【问题描述】:

在本地 vNext 构建代理上从 Visual Studio Team Services 触发构建在从存储库获取源时失败,可能是因为公司代理。 VSTS 上的构建日志显示:

2016-01-28T12:35:03.7688078Z Syncing repository: MyProject (TFVC)
2016-01-28T12:35:03.7688078Z workspaceName=ws_3_3
2016-01-28T12:35:05.0730362Z ##[error]HTTP code 407: Proxy Authentication Required
2016-01-28T12:35:05.3257849Z ##[error]Prepare repository failed with exception.

在构建服务器上,代理日志显示以下异常:

16:17:14.895983 System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: Prepare repository failed with exception. ---> Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: HTTP code 407: Proxy Authentication Required ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.

16:17:14.895983    at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)    
16:17:14.895983    at System.Net.HttpWebRequest.GetRequestStream()
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException& webException)
16:17:14.895983    --- End of inner exception stack trace ---
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(TfsMessage requestMessage, HttpWebResponse webResponse, WebException webException, TfsMessage& responseMessage)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
16:17:14.895983    at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureConnected(ConnectOptions optionsNeeded)
16:17:14.895983    at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.get_AuthorizedIdentity()
16:17:14.895983    at Microsoft.TeamFoundation.VersionControl.Client.Client.ResolveUserUniqueName(String user)
16:17:14.895983    at Microsoft.TeamFoundation.VersionControl.Client.Client.GetLocalWorkspace(String workspaceName, String workspaceOwner)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.TfvcHelper.SyncRepository(VersionControlServer server, Uri repositoryUrl, String workspaceName, String rootPath, WorkingFolder[] workingFolders, String sourceVersion, Boolean cleanRepository, String shelveset, CancellationToken cancellationToken)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.Core.TfvcHelper.Sync(ITaskEndpoint endpoint, String localPath, Dictionary`2 serverPathMapping, String sourceVersion, Boolean cleanRepository, String workspaceName, String shelveset, String& actualSourceVersion, CancellationToken cancellationToken)
16:17:14.895983    at Microsoft.TeamFoundation.DistributedTask.Plugin.Build.TfvcSourceProvider.<>c__DisplayClass3_0.<PrepareRepositoryAsync>b__0()
16:17:14.895983    --- End of inner exception stack trace ---

关于 407 代理身份验证错误有很多类似的问题,建议更改配置文件,但没有具体针对 vNext 构建代理的问题。是否有可以编辑的配置文件来解决此问题?

【问题讨论】:

    标签: tfs azure-devops tfsbuild http-proxy azure-pipelines


    【解决方案1】:

    您需要更改的配置文件是VsoWorker.exe.config,可以在以下位置找到C:\BuildAgent\TFS_Build\agent\agent\Worker

    &lt;configuration&gt; 块内添加以下代码:

    <system.net>
      <defaultProxy useDefaultCredentials="true">
      </defaultProxy>
    </system.net>
    

    【讨论】:

      【解决方案2】:

      我在公司代理后面使用 VSTS,但已经在全球范围内设置了我的 git 代理。如果我已经这样做了(所以可以从命令行从集合中提取)然后使用最新的 vso 代理它就可以工作:

      https://github.com/Microsoft/vsts-agent

      【讨论】:

        猜你喜欢
        • 2010-11-15
        • 1970-01-01
        • 2018-03-10
        • 1970-01-01
        • 2016-09-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多