我正在使用Microsoft.VisualStudio.Services.Release程序包中的ReleaseHttpClientBase,但出现了一些奇怪的现象。因此,我在每个TFS项目上都调用GetReleaseDefinitionsAsync,但是我从TFS获得了套接字异常。奇怪的是,如果我正在运行Fiddler,它每次都会工作。我无法弄清楚。
public IEnumerable<ReleaseDefinition> GetReleaseDefinitions()
{
IEnumerable<CatalogNode> collectionNodes = GetCollectionNodes();
IEnumerable<ReleaseDefinition> releaseDefinitions = new List<ReleaseDefinition>();
//collectionNodes = collectionNodes.Skip(4);
foreach(var collectionNode in collectionNodes)
{
var uri = new Uri(TfsUri,collectionNode.Resource.DisplayName);
var releaseClient = GetHttpClient(uri);
IEnumerable<string> projectNames = GetListOfProjectNames(collectionNode);
foreach(string projectName in projectNames)
{
releaseDefinitions = releaseDefinitions.Concat(releaseClient.GetReleaseDefinitionsAsync(project: projectName).Result);
}
releaseClient.Dispose();
}
return releaseDefinitions;
}