简体   繁体   English

尝试连接到Team Foundation Server时出错

[英]Error when trying to connect to Team Foundation Server

I'm trying to connect to our online TFS. 我正在尝试连接到我们的在线TFS。 This is what I currently have: 这是我目前拥有的:

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 throws me : 这把我扔了:

TF30063: You are not authorized to access https://actacom.visualstudio.com/DefaultCollection . TF30063:您无权访问https://actacom.visualstudio.com/DefaultCollection

The Credentials entered are correct. 输入的凭据正确。

Check this blog post , it has a sample code on how to do it. 检查此博客文章 ,其中包含有关如何执行此操作的示例代码。 I've tried it with my VSO account and it worked just fine. 我已经用我的VSO帐户尝试过,并且效果很好。

The blog helped me out. 博客帮助了我。 For other people, here is the working code. 对于其他人,这是工作代码。

 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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM