VSTS使用vssClientCredentials进行身份验证 [英] VSTS Authenticating with vssClientCredentials

查看:121
本文介绍了VSTS使用vssClientCredentials进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用下面的代码连接到VSTS项目,以前在显示的对话框中输入凭据后已成功连接.

I am currently trying to connect to a VSTS project using the code below, I have previously connected successfully after entering credentials into the dialog box shown.

if (!IsConnected)
{
    sourceControl = release.SourceControl;
    connection = new VssConnection(new Uri(sourceControl), new VssClientCredentials());
    workItemTrackingHttpClient = connection.GetClient<WorkItemTrackingHttpClient>();
}

该对话框不再显示,并引发异常:

The dialog box is no longer shown and an exception is thrown:

TF400813:资源不可用于匿名访问.客户 需要验证.

TF400813: Resource not available for anonymous access. Client authentication required.

我不知道可能导致此中断的任何更改,将不胜感激任何帮助.

I am unaware of any changes that could have caused this to break, any help would be greatly appreciated.

推荐答案

您可以从注册表中删除缓存的凭据:Computer\HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio(删除 VssApp 项)

You can delete the cached credential from registry: Computer\HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio (delete VssApp key)

您还可以指定凭据存储:

You also can specify the credential storage:

var c = new VssClientCredentials();
c.Storage = new VssClientCredentialStorage(storageKind: "VssApp2", storageNamespace: "VisualStudio");
connection = new VssConnection(new Uri(sourceControl), c);

这篇关于VSTS使用vssClientCredentials进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆