c# - Visual Studio 在线 TF30063 : You are not authorized to access

标签 c# azure-devops

我正在尝试通过 Web API 连接到我的 Visual Studio Online 帐户。按照这里的步骤操作:

http://blogs.msdn.com/b/buckh/archive/2013/01/07/how-to-connect-to-tf-service-without-a-prompt-for-liveid-credentials.aspx

NetworkCredential netCred = new NetworkCredential(
    "myaccount@gmail.com",
    "mypassword");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
    new Uri("https://myaccount.visualstudio.com/DefaultCollection"),
    tfsCred);

tpc.EnsureAuthenticated();
Console.WriteLine(tpc.InstanceId);

但是我收到以下错误消息:

TF30063: You are not authorized to access .visualstudio.com

最佳答案

在尝试了书中的每个编码选项之后,我转向了另一种方法:

从 Visual Studio Online 注销:

  • 浏览器
  • Visual Studio IDE 中的浏览器
  • 从 C:\Users\[您的用户名]\AppData\Local\Microsoft\Team Foundation\5.0\Cache 清除了我的缓存

它奏效了...:)

关于c# - Visual Studio 在线 TF30063 : You are not authorized to access,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22196791/

相关文章:

php - 具有 OpenID Connect 和 PKCE 的 Azure B2C

azure cli 添加应用程序注册范围

c# - 为什么会在运行时陷入困境?

c# - 在 .Net 中创建和验证 x509 证书

c# - WPF 的 GUI 想法,虽然不知道如何实现它

java - AES Rijndael 解密 C#

c# - 如何以编程方式检测代码是否在共享 DLL 或 exe 中运行?

azure - 需要替换 azure devops 管道中预定义变量的别名值

powershell - VSTS - 在发布期间删除以前的部署

azure - 如何解决 Azure Devops Pipeline 中的 -apptype 缺失错误