我尝试从代码连接到 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”。
所以,这可能是因为我:
- 使用了错误的连接字符串。 (我希望不是)
- 我没有权限。 所以,我认为它可能是第二种变体。我如何从代码登录到 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/