tfs - GetWorkItemsAsync 在检索 1800 个工作项时失败

标签 tfs

GetWorkItemsAsync 在检索 1800 个工作项时失败。示例:

int[] ids = (from WorkItem info in wlinks select info.Id).ToArray();
WorkItemTrackingHttpClient tfvcClient = _tfs.GetClient<WorkItemTrackingHttpClient>();
List<Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem> dworkitems = tfvcClient.GetWorkItemsAsync(ids).Result;

如果我传递包含 90 个元素的 Id 数组,则效果很好。

是否有限制只能获取n个元素,我们如何克服这个问题?

最佳答案

是的,URL 长度有限制,一旦超过 URL 长度就会出现此异常。

因此,作为解决方法,您可以将一次调用限制在允许的范围内(例如一次 200 个 ID)。然后多次调用查询。

Unfortunately you’ve hit a limitation of the URL length. Once the URL length has been exceeded, the server just gets the truncated version, so odds are high that the truncated work item id is not valid.

I recommend limiting your calls to 200 ids at a time.

Source here : https://github.com/Microsoft/vsts-dotnet-samples/issues/49

关于 URL 长度的限制,请引用此线程:What is the maximum length of a URL in different browsers?

类似的帖子供您引用:Is there any restriction for number of characters in TFS REST API?

关于tfs - GetWorkItemsAsync 在检索 1800 个工作项时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47882457/

相关文章:

tfs - 如何配置 TFS 2012 燃尽图来跟踪错误?

tfs 项目警报

tfs - 如何将现有项目添加到 TFS

maven - 使用 maven、teamcity 和 TFS 的分支策略

tfs - 对于 UInt32 : TFS Checkin Error 来说值太大或太小

tfs - 共享资源范围获取锁失败

c# - 无法从 TFS 获取 VersionControlServer 服务

tfs - 如何从Visual Studio中在TFS中打开单个变更集

TFS 发布管理有一个卡在进行中的发布

.net - SonarQube MSBuild Scanner 不会从分析中排除文件