c# - TF31002 : Unable to connect to this Team Foundation Server (from code)

标签 c# tfs

我尝试从代码连接到 TFS:

 public TFS2013Client(Uri tfsURI, Logger logger)
    {
        _logger = logger;

        TfsURI = tfsURI;
        _configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(TfsURI);

        _server = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsURI);
        _version = _server.GetService(typeof(VersionControlServer)) as VersionControlServer; //error at this line
    }

因此,在我的 Visual Studio 中,我可以连接到 TFS。 在代码中,我使用这样的 URI:“http://tfs-server:8080/tfs”。

所以,这可能是因为我:

  1. 使用了错误的连接字符串。 (我希望不是)
  2. 我没有权限。 所以,我认为它可能是第二种变体。我如何从代码登录到 TFS?

谢谢!

最佳答案

您需要提及您的项目集合名称并使用“http://tfs-server:8080/tfs/projectcollectionname”代替http://tfs-server:8080/tfs

关于c# - TF31002 : Unable to connect to this Team Foundation Server (from code),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32740154/

相关文章:

visual-studio-2010 - Visual Studio 2010 在启动时崩溃

tfs - 将 XAML-Builds 与 TFS 2018 Update 2 结合使用

c# - 是否可以以编程方式运行 specflow 测试?

c# - Stream Reader 进程无法访问文件,因为它正在被另一个进程使用

c# - 如何在运行时更改 wpf 中的 xmldataprovider 源?

npm - TFS npm install 构建任务挂起?

intellij-idea - 无法从Intellij IDEA 2016.1.3连接到TFS服务器:“无法加载工作空间:已联系主机,但未找到TFS服务”

c# - 启动 Windows 服务的超时时间是多少?

c# - 取消订阅后,我如何等待一切都在 Rx 可观察序列中完成?

c# - 在 C# 中为多线程锁定 DataTable 的正确方法?