2016-12-28 71 views
0

我有一个应用程序封装了与TFS REST API的交互以排队构建。应用程序只需将所需的json发送到API,并且它会持续数月,直到它突然开始返回409 - 冲突。409冲突响应使用TFS 2015 REST API来构建队列

System.Net.WebException: The remote server returned an error: (409) Conflict. (https://tfs2015/tfs/spf/SPF/_apis/build/builds?api-version=2.0 :{"definition":{"id":190},"parameters":"{}"})

w3.org定义HTTP代码409:

The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.

409不会消失或者 - 一个简单的重试一贯失败。即使是整个“你尝试重新启动构建服务器的方法都没有帮助”。

回答

0

事实证明,这里的“冲突”实际上并不是某种奇怪的并发问题,而是一种无法满足构建需求的状态。

基本上,排队的构建定义需要“PowerShell = 4”。在构建服务器更新到PowerShell 5后,构建开始给予409。

在这种情况下,409意味着池中的任何构建代理都无法满足构建要求。

更改构建定义以要求使用PowerShell而不是特定版本的PowerShell修复此问题。

(如果我的应用程序将整个响应转储到控制台,我可以尽早完成这项工作,所以我将在不久的将来更新它)。