Getting TF400324: Team Foundation services are not available from server http://[servername]:8080/tfs/ error when trying to iterate through project names in collection


  • Hi,

    We currently have two instances of TFS 2012 on two different servers, SERVER1 and SERVER2 for simplicity. SERVER1 is a new installation of TFS2012 and few agile projects were created under the defaultcollection collection, no projects were brought into this instance, just created straight from scratch. This server also hosts the TFS2012 build agent.

    SERVER2 is also a new installation of TFS2012, however, on this server the collection and projects were created using the upgrade method to move projects from TFS2008 directly to TFS2012 (no TFS2010 in between). The http://SERVER2:8080/tfs/testupgrade is the main URL for this upgraded collection.

    Now, to test just listing the projects in the collection, I'm using a small console application, where the only difference is the URL provided to get the project names from. Below is the main logic on how I'm fetching the project names. But the main results are that when I use http://SERVER1:8080/tfs/ as the URL to get the project names from, I have no errors with the logic below and works fine. But if I use http://SERVER2:8080/tfs/ as the URL, only the logic when using the ConfigurationServer method displays the project names. The second method, using TfsTeamProjectCollection, throws the error in the title of this question when I hit the line "_workItemStore = _tfsServer.GetService<workItemStore>();". Even though I'm not using this _workItemStore variable in this program, I'm simulating the initialization of these objects to make sure another project I have works fine.

    I am wondering if there could be a setting/configuration issue on SERVER2 that might be causing this error. Any ideas? Thanks!

    Here's the logic:

    namespace CollectionTester
        class Program
            static void Main(string[] args)
                IBuildServer buildServer;

                // Connect to Team Foundation Server
                //     Server is the name of the server that is running the application tier for Team Foundation.
                //     Port is the port that Team Foundation uses. The default port is 8080.
                //     VDir is the virtual path to the Team Foundation application. The default path is tfs.
                Uri tfsUri = (args.Length < 1) ?
                    new Uri("http://{SERVER1|SERVER2}:8080/tfs/") : new Uri(args[0]);

                TfsConfigurationServer configurationServer =

                // Get the catalog of team project collections
                ReadOnlyCollection<CatalogNode> collectionNodes = configurationServer.CatalogNode.QueryChildren(
                    new[] { CatalogResourceTypes.ProjectCollection },
                    false, CatalogQueryOptions.None);

                // List the team project collections
                foreach (CatalogNode collectionNode in collectionNodes)
                    // Use the InstanceId property to get the team project collection
                    Guid collectionId = new Guid(collectionNode.Resource.Properties["InstanceId"]);
                    TfsTeamProjectCollection teamProjectCollection = configurationServer.GetTeamProjectCollection(collectionId);

                    // Print the name of the team project collection
                    Console.WriteLine("Collection: " + teamProjectCollection.Name);

                    // Get a catalog of team projects for the collection
                    ReadOnlyCollection<CatalogNode> projectNodes = collectionNode.QueryChildren(
                        new[] { CatalogResourceTypes.TeamProject },
                        false, CatalogQueryOptions.None);

                    // List the team projects in the collection
                    foreach (CatalogNode projectNode in projectNodes)
                        Console.WriteLine(" Team Project: " + projectNode.Resource.DisplayName);
                        buildServer = (IBuildServer)teamProjectCollection.GetService(typeof(IBuildServer));
                        IBuildDefinition[] buildDefinitions =
                        foreach (IBuildDefinition buildDefinition in buildDefinitions)
                            Console.WriteLine("\tBuild Definition: " + buildDefinition.Name);


                Console.Write("Press ENTER to continue...");

                WorkItemStore _workItemStore;
                TfsTeamProjectCollection _tfsServer;
                VersionControlServer _versionControlServer;
                Project _teamProject;

                _tfsServer = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri);
                _workItemStore = _tfsServer.GetService<WorkItemStore>();
                _versionControlServer = _tfsServer.GetService<VersionControlServer>();

                ReadOnlyCollection<CatalogNode> projectNodesList =
                    _tfsServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.TeamProject }, false,

                foreach (CatalogNode projectNode in projectNodesList)
                        Console.WriteLine("projectNode.Resource.DisplayName: " + projectNode.Resource.DisplayName);
                Console.Write("Press ENTER to finish...");


    Alex Islas-Montantes

    Friday, November 23, 2012 8:32 PM


  • We were able to get past that error by clearing the cache that was stored in my local box for Team Foundation. I was flipping between versions of TFS (Test and Prod) so my permissions were being cached at times.

    Alex Islas-Montantes

    • Marked as answer by Jandro Islands Monday, September 09, 2013 6:49 PM
    Monday, September 09, 2013 6:49 PM

All replies

  • Hi Alex,

    Thanks for your post!

    If you use Team Explorer to connect http://SERVER2:8080/tfs/, can it be successful?

    Can you try another PC?

    Do any other users on your dev team (if there are any) see this issue?

    In addition, please capture a fiddler trace which can help to check the issue, please refer to http://fiddler2.com/fiddler2/

    Hope it helps!

    Best Regards,

    Cathy Kong [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 26, 2012 8:40 AM
  • Hi Cathy,

    I had another person try this same logic in the same solution I'm using against TFS2012 and he got the same error when using http://SERVER2:8080/tfs. My co-worker when he tried both URLs (http://SERVER1:8080/tfs and http://SERVER2://SERVER2:8008/tfs) he got the same results as what I described in my original question, so does not seem to be system- or computer-specific. He also was able to connect to http://SERVER2:8080/tfs through Team Explorer in Visual Studio without problems.

    As for the fiddler session, I'm not sure how I can use it to capture web traffic within a console application. I tried looking online for some info on this but couldn't get it to capture any session info. I also tried just a GET request using the composer and no response was sent back, it seemed that that was due to authentication settings. I ran fiddler as both admin and normal user on my laptop. Thanks!


    Alex Islas-Montantes

    Monday, November 26, 2012 3:19 PM
  • Hi Jandro,

    TF400324 error could happen only when the service stopped between client and TFS. Check your network connection once whether it is available or not. 


    Monday, September 09, 2013 2:40 PM
  • We were able to get past that error by clearing the cache that was stored in my local box for Team Foundation. I was flipping between versions of TFS (Test and Prod) so my permissions were being cached at times.

    Alex Islas-Montantes

    • Marked as answer by Jandro Islands Monday, September 09, 2013 6:49 PM
    Monday, September 09, 2013 6:49 PM