Admiral Land
Admiral Land

Reputation: 2492

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

I try to connect to TFS from code:

 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
    }

So, at my Visual Studio i can connect to TFS. At code i use URI like this: "http://tfs-server:8080/tfs".

So, it can be because i:

  1. Use wrong connection string. (i hope it is not)
  2. I have no permissions. So, i this, that it may be second variant. How i can log in into TFS from code?

Thank you!

Upvotes: 1

Views: 3310

Answers (1)

amit dayama
amit dayama

Reputation: 3326

you need to mention your projectcollectionname as well use "http://tfs-server:8080/tfs/projectcollectionname" instead of http://tfs-server:8080/tfs

Upvotes: 4

Related Questions