创建后无法在构建/部署定义 (vnext) 中选择 TFS 2015 机器组

Posted

技术标签:

【中文标题】创建后无法在构建/部署定义 (vnext) 中选择 TFS 2015 机器组【英文标题】:TFS 2015 machine groups cannot be selected in build/deployment definition (vnext) after creation 【发布时间】:2016-04-12 13:30:41 【问题描述】:

我们在安装 TFS 2015(从 2010 年升级)时遇到问题。我们遇到了以下问题。这涉及空运行,因此我们将所有内容安装在同一台服务器上,我们知道这不是首选方法。

• 使用 Windows Server 2012 R2 安装了新的虚拟服务器

• 添加了 IIS 功能

• 已安装 SQL Server 2014

• 在服务器上安装了 sharepoint Foundation 2013

• 在服务器上安装了 Visual Studio 2015

• 安装了所有必要的 .NET 目标框架

• 安装了 MS Build tools 2015、Agents for Microsoft Visual Studio 2015 等先决条件

• 将 TFS2010 备份恢复到新的 SQL 服务器

• 安装 tfs 2015 并在设置中运行“升级”选项

• 处理了配置中的所有步骤,例如添加构建控制器和构建代理

• 下载 Vso 代理并运行“ConfigureAgent.cmd”

• 在 TFS 中配置代理池和队列

• 添加了额外的团队项目集合。因此,我们收集了 2010 年以来的旧升级项目,以及一系列新的团队项目

• 管理团队项目、团队成员等。

• 创建 XAML 构建定义,在服务器上正确完成构建,执行测试

然而,

如果我尝试使用部署模板创建一个新的(非 XAML)构建定义(参见图片)。 当我们要选择“测试机器组/Azure 资源组”时会出现问题,例如选择测试位置时。选择列表为空。 因此,我们使用“管理”选项添加了机器组,并且机器组可用。但是,即使在刷新后,带有机器组的下拉列表仍为空(参见图片)。

接下来我们检查了他的问题的事件日志。刷新下拉列表时,会在事件日志中创建以下条目:

第一:

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Microsoft-Team Foundation Server" Guid="80761876-6844-47D5-8106-F8ED2AA8687B" /> 
  <EventID>0</EventID> 
  <Version>3</Version> 
  <Level>2</Level> 
  <Task>1</Task> 
  <Opcode>10</Opcode> 
  <Keywords>0x8000000000000001</Keywords> 
  <TimeCreated SystemTime="2016-04-12T09:09:21.717163200Z" /> 
  <EventRecordID>59666</EventRecordID> 
  <Correlation ActivityID="6AD40FD3-10BA-4A7E-B6D9-F6926072DAB4" /> 
  <Execution ProcessID="3376" ThreadID="6484" /> 
  <Channel>Microsoft-Team Foundation Server/Debug</Channel> 
  <Computer>KTBSV021.KTB.local</Computer> 
  <Security UserID="S-1-5-21-2105344776-4230907741-261866850-3716" /> 
  </System>
- <UserData>
- <Info TraceId="00000001-0001-0001-0000-000000000000" xmlns="http://schemas.microsoft.com/TeamFoundation/2010/Framework">
  <Tracepoint>0</Tracepoint> 
  <ServiceHost>87670F79-6386-4363-9960-73B634419263</ServiceHost> 
  <ContextId>10085</ContextId> 
  <ProcessName>w3wp</ProcessName> 
  <Username>KTB\tmpadmin</Username> 
  <VSID>9E83242F-9944-4CBD-AF10-EF2D449A03B1</VSID> 
  <Service>Web-Api</Service> 
  <Method>TaskDefinitionWebApiProxy.QueryEndpoint</Method> 
  <Area>DistributedTask</Area> 
  <Layer>WebApiProxy</Layer> 
  <UserAgent>Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko</UserAgent> 
  <Uri>/tfs/Default/_apis/distributedtask/endpoint</Uri> 
  <Path /> 
  <UniqueIdentifier>A9646429-41CB-4137-A39A-D4E29EDDC389</UniqueIdentifier> 
  <UserDefined /> 
  <ExceptionType>System.Net.WebException</ExceptionType> 
  <Message>System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Microsoft.TeamFoundation.DistributedTask.Server.WebApiProxy.HttpRequestProxy.ExecuteRequest(HttpRequestMessage requestMessage, IList`1 sourceDefinitions, DataSource dataSource)</Message> 
  </Info>
  </UserData>
  </Event>

第二:

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Microsoft-Team Foundation Server" Guid="80761876-6844-47D5-8106-F8ED2AA8687B" /> 
  <EventID>0</EventID> 
  <Version>3</Version> 
  <Level>2</Level> 
  <Task>1</Task> 
  <Opcode>10</Opcode> 
  <Keywords>0x8000000000000001</Keywords> 
  <TimeCreated SystemTime="2016-04-12T09:09:21.717163200Z" /> 
  <EventRecordID>59667</EventRecordID> 
  <Correlation ActivityID="6AD40FD3-10BA-4A7E-B6D9-F6926072DAB4" /> 
  <Execution ProcessID="3376" ThreadID="6484" /> 
  <Channel>Microsoft-Team Foundation Server/Debug</Channel> 
  <Computer>KTBSV021.KTB.local</Computer> 
  <Security UserID="S-1-5-21-2105344776-4230907741-261866850-3716" /> 
  </System>
- <UserData>
- <Info TraceId="00000001-0001-0001-0000-000000000000" xmlns="http://schemas.microsoft.com/TeamFoundation/2010/Framework">
  <Tracepoint>103200</Tracepoint> 
  <ServiceHost>87670F79-6386-4363-9960-73B634419263</ServiceHost> 
  <ContextId>10082</ContextId> 
  <ProcessName>w3wp</ProcessName> 
  <Username>KTB\tmpadmin</Username> 
  <VSID>9E83242F-9944-4CBD-AF10-EF2D449A03B1</VSID> 
  <Service>Web-Api</Service> 
  <Method>TaskDefinitionWebApiProxy.QueryEndpoint</Method> 
  <Area>DistributedTask</Area> 
  <Layer>TaskDefinitionWebApiProxy</Layer> 
  <UserAgent>Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko</UserAgent> 
  <Uri>/tfs/Default/_apis/distributedtask/endpoint</Uri> 
  <Path /> 
  <UniqueIdentifier>A9646429-41CB-4137-A39A-D4E29EDDC389</UniqueIdentifier> 
  <UserDefined /> 
  <ExceptionType>Microsoft.TeamFoundation.DistributedTask.WebApi.ServiceEndpointQueryFailedException</ExceptionType> 
  <Message>Microsoft.TeamFoundation.DistributedTask.WebApi.ServiceEndpointQueryFailedException: The remote server returned an error: (401) Unauthorized. at Microsoft.TeamFoundation.DistributedTask.Server.WebApiProxy.HttpRequestProxy.ExecuteRequest(HttpRequestMessage requestMessage, IList`1 sourceDefinitions, DataSource dataSource) at Microsoft.TeamFoundation.DistributedTask.Server.Controllers.TaskDefinitionWebApiProxyController.QueryEndpoint(TaskDefinitionEndpoint endpoint) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()</Message> 
  </Info>
  </UserData>
  </Event>

Fiddler 报告以下请求失败:

POST http://localhost:8080/tfs/Default/_apis/distributedtask/endpointHTTP/1.1

• 服务器上已启用 Powershell Remote。

• 服务帐户已添加到代理池中的角色。

这显然是一个安全问题。我们忘记了什么或做错了什么?

【问题讨论】:

所以错误是:System.Net.WebException:远程服务器返回错误:(401)未经授权。在 System.Net.HttpWebRequest.GetResponse() 在 Microsoft.TeamFoundation.DistributedTask.Server.WebApiProxy.HttpRequestProxy.ExecuteRequest(HttpRequestMessage requestMessage, IList`1 sourceDefinitions, DataSource dataSource) 【参考方案1】:

你的问题有点像this post。您可以尝试this case 中的解决方案,将 TFS 服务帐户添加到具有完全访问权限的 C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys,以便该服务可以访问所有证书。

但首先,请尝试使用您本应添加为团队项目集合管理员或代理池管理员的帐户重新部署代理。

【讨论】:

抱歉,这并没有解决问题。问题仍然存在。 您是否尝试过重新部署代理或创建新代理? 其他团队成员能否看到他们机器上的下拉列表?尝试更改属于 Build Agent Service Accounts 组成员且属于“Agent Pool Service Account”角色的域帐户,看看它是否有效。 感谢您的回复。都试过了,还是不行。尝试从不同的机器和不同的帐户。下拉菜单保持空白。请注意,管理机器组(相同的浏览器和帐户)没有问题,只是当您返回创建 builddefinition 时,下拉列表为空(刷新后也是如此) 我遇到了同样的问题。它在更新 2 之前工作,但是,在安装更新 2 之后,我们得到完全相同的问题: "$id":"1","innerException":null,"message":"远程服务器返回错误:( 401) 未经授权。","typeName":"Microsoft.TeamFoundation.DistributedTask.WebApi.ServiceEndpointQueryFailedException, Microsoft.TeamFoundation.DistributedTask.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","typeKey":"ServiceEndpointQueryFailedException ","errorCode":0,"eventId":3000

以上是关于创建后无法在构建/部署定义 (vnext) 中选择 TFS 2015 机器组的主要内容,如果未能解决你的问题,请参考以下文章

在VNext构建中执行Visual Studio Test任务期间无法发布测试结果

使用 vNext 构建后将内部版本号与 TFS 工作项相关联

abp.io(vNext)部署备忘

abp.io(vNext)部署备忘

是否能够忽略/禁用 vNext Build 中的第一步获取源代码?

TFS 2015 更新 3 Vnext 构建定义复制除父项目之外的所有工件