问题描述
我目前正在尝试使用下面的代码连接到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:
我不知道可能导致此中断的任何更改,将不胜感激任何帮助.
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进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!