尝试连接到团队基础服务器时出错
本文关键字:服务器 出错 团队 连接 | 更新日期: 2023-09-27 18:16:24
我正在尝试连接到我们的在线TFS。这是我目前拥有的:
NetworkCredential cred = new NetworkCredential(textBox_Username.Text,
textBox_password.Password);
Uri TFSurl = new Uri("https://myCompany.visualstudio.com/DefaultCollection");
TfsConfigurationServer tfs = new TfsConfigurationServer(TFSurl, cred);
tfs.EnsureAuthenticated();
This throw me:
TF30063:您没有权限访问https://actacom.visualstudio.com/DefaultCollection.
输入的凭据正确
查看这篇博文,它有一个关于如何做到这一点的示例代码。我已经尝试过它与我的VSO帐户,它工作得很好。
这个博客帮了我。对于其他人,这里是工作代码。
NetworkCredential netCred = new NetworkCredential(
textBox_Username.Text,
textBox_password.Password);
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("https://fabrikam.visualstudio.com/DefaultCollection"),
tfsCred);
tpc.Authenticate();