【发布时间】:2016-12-20 13:56:03
【问题描述】:
我正在使用以下代码连接到 TFS
TfsTeamProjectCollection server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serverName));
server.EnsureAuthenticated();
它工作正常。虽然最近我们已经从本地 TFS 迁移到 VSTS(在云中)。以上仍然有效,但已设置本地代理服务器以帮助加快我们的连接。我可以按照上面的代码进行配置:
var versionControlServer = server.GetService<VersionControlServer>();
versionControlServer.ConfigureProxy(proxyName);
这似乎第一次连接良好。但是,如果我重新启动我的应用程序,“EnsureAuthenticated”调用会失败并出现异常:
Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: You are not authorized to access mycorp.visualstudio.com\mycorp.
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
at Microsoft.TeamFoundation.Framework.Client.LocationWebService.Connect(Int32 connectOptions, Int32 lastChangeId, Int32 features)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.Connect(ConnectOptions connectOptions)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureConnected(ConnectOptions optionsNeeded)
at Microsoft.TeamFoundation.Framework.Client.FrameworkServerDataProvider.EnsureAuthenticated()
at Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated()
为了让它再次工作,我发现如果我退出 Visual Studio,我可以删除文件夹 "C:\Users\MyUser\AppData\Local\Microsoft\Team Foundation\6.0\Cache"。当我再次运行我的应用程序时,它将正常连接。但是,这种解决方法在生产中不起作用。
如何使用代理连接并多次连接?
【问题讨论】:
-
详细的内部错误信息是什么?
标签: c# tfs azure-devops