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/