我正在使用以下代码尝试连接到Azure DevOps并检索工作项类型的列表,但是我不断收到此异常:
BrowserFlowException:SP324098:您的浏览器无法完成 操作
关于此异常的信息似乎很少。有人知道这是怎么回事吗?我正在将Visual Studio 2017,Enterprise Edition更新为最新版本,并将Windows 10更新为最新生成机器。
VssClientCredentials credentials = new VssClientCredentials();
VssClientHttpRequestSettings settings = new VssClientHttpRequestSettings
{
AllowAutoRedirect = true
};
VssHttpMessageHandler vssHandler = new VssHttpMessageHandler(credentials, settings);
using (VssConnection connection = new VssConnection(this.CollectionUri, credentials, settings))
{
connection.ConnectAsync().SyncResult();
// Create instance of WorkItemTrackingHttpClient using VssConnection
WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
var workItemTypes = witClient.GetWorkItemTypesAsync(ProjectName).SyncResult(); ; //exception happens here, I see the login box here too
}
答案 0 :(得分:0)
您不需要使用VssClientHttpRequestSettings
和VssHttpMessageHandler
。
您可以通过以下方式获取类型:
VssClientCredentials credntials = new VssClientCredentials();
using (VssConnection connection = new VssConnection(this.CollectionUri, credentials))
{
WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
var workItemTypes = witClient.GetWorkItemTypesAsync(ProjectName).SyncResult();
}