Share via


The connection to the data-tier server failed

The information in this article applies to:

  • Visual Studio 2005 Team Foundation Server

  • Visual Studio Team System 2008 Team Foundation Server

  • SQL Server 2005 or SQL Server 2008

  • Application-tier server

  • Data-tier server

  • Health check

The Best Practices Analyzer tool for Team Foundation Server performs several tests to determine whether the database connection is configured correctly. An information message appears and contains the connection string that is defined in the Services Web.config file for Team Foundation.

If the connection is not correctly configured, one of the following errors appears:

  • Cannot connect to the data tier computer.

    This error indicates that a connection to the database instance could not be made by using the connection string that is defined in the Services Web.config file for Team Foundation. If this error appears, you should investigate the following possible causes first:

    • The data-tier server is not available.

    • SQL Server is not running on the data-tier server.

    • The name of the database instance that is defined in the Web.config file is not correct.

    To resolve this issue, verify the connection to the database instance. For more information, see Verifying That You Can Connect to the Database Instance. If the database instance is available and SQL Server is running, you must change the name of the data source that is defined in the Services Web.config file so that the name points to the data-tier server. For more information, see Correcting the Connection String in the Services Web.config File.

  • Data tier computer name mismatch in configuration file and database tables.

    This error indicates that the connection string that is defined in the Services Web.config file specifies a name that differs from the name of the database instance in the tbl_database table of the TfsIntegration database. The error provides the values that are defined in the Web.config file and the TfsIntegration database. The most likely cause for this condition is that the previous use of the TFSAdminUtil RenameDT command was not successful.

    To resolve this issue, you must change the name of the database instance that is defined in the Services Web.config file to match the name that is defined in the TfsIntegration database. For more information, see Correcting the Connection String Stored in the Services Web.config File.

    After you make this change, the actual name of the database instance might be different from the one that is defined in the TfsIntegration database. In this case, you should run TFSAdminUtil RenameDT to correct the name of the database instance in both locations.

  • Team Foundation Server service account has no SQL login.

    This error indicates that the identity that is assigned to the application pool for Team Foundation Server does not match the SQL Login account for Team Foundation Server on the data-tier server. This condition occurs most often when a user changes the identity of the pool manually, instead of by using the TFSAdminUtil ChangeAccount command.

    To resolve this issue, run the TFSAdminUtilChangeAccount command to reset the service account that is assigned to the application pool. For more information, see Resetting the Service Account That Is Assigned to the Application Pool for Team Foundation Server.

Required Permissions

To perform these procedures, you must be a member of the Administrators security group on the data-tier or application-tier server for Team Foundation.

Verifying That You Can Connect to the Database Instance

To verify a connection to the database instance

  1. Log on to the data-tier server.

  2. Open the Start menu, point to AllPrograms, point to Microsoft SQL Server 2005 or Microsoft SQL Server 2008, and then click SQL Server Management Studio.

    The Connect to Server dialog box opens.

  3. Under Server type, click Database Engine, type the name of the server to which you want to connect, and then click Connect.

    Note

    If SQL Server is installed on a cluster, type the name of the cluster and not the computer name. If you have specified a named instance, type the server and instance name in the following format: DatabaseServer\InstanceName.

    SQL Server Management Studio opens.

  4. In Object Explorer, verify that a green arrow appears next to the server name.

    Note

    If you cannot connect to the server, verify the firewall settings, and then try to connect again.

Correcting the Connection String in the Services Web.config File

To change the server name that is defined in the connection string key of the Services Web.config file

  1. Log on to the application-tier server.

  2. Open Windows Explorer, and locate the Services directory.

    By default, this directory is in the following location, depending on your version of Team Foundation Server: 

    • Drive:\%ProgramFiles%\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services

    • Drive:\%ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services

  3. Open the Web.config file in Notepad or any text-based editor.

    Note

    Even if you are logged on with administrative credentials, you must open Notepad as an administrator to perform this function on a server that is running Windows Server 2008. To open Notepad as an administrator, click Start, right-click Command Prompt, and click Run as administrator. For more information, see the Microsoft Web site.

  4. Under the appSettings node, locate the ConnectionString key.

  5. Change the value that is assigned to the Data Source to point to the database instance.

    The format is ComputerName\TFSInstance. For the default instance, the format is ComputerName. This value must match the value that is defined in the tbs_database table of the TfsIntegration database.

  6. Save the file, and close Notepad.

  7. If the name of the database instance has changed from the value that is defined in the TfsIntegration database, run the TFSAdminUtil RenameDT command.

    1. Log on to the application-tier server.

    2. Open a Command Prompt window, and change directories to the following location, depending on your version of Team Foundation Server:

      Drive:\%ProgramFiles%\Microsoft Visual Studio 2005 Team Foundation Server\Tools

      or

      Drive:\%ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Tools

      Note

      Even if you are logged on with administrative credentials, you must open an elevated Command Prompt to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt, click Start, right-click Command Prompt, and click Run as administrator. For more information, see the Microsoft Web site.

    3. Type the following command, and then press ENTER:

      TfsAdminUtil RenameDT newDatatierServerName

Resetting the Service Account That Is Assigned to the Application Pool for Team Foundation Server

To reset the service account that is assigned to the application pool

  1. Log on to the application-tier server.

  2. Open a Command Prompt window, and locate the TFSAdminUtil utility.

    Note

    Even if you are logged on with administrative credentials, you must open an elevated Command Prompt to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt, click Start, right-click Command Prompt, and click Run as administrator. For more information, see the Microsoft Web site.

    By default, this utility is located in the following directory, depending on your version of Team Foundation Server:

    • Drive:\%ProgramFiles%\Microsoft Visual Studio 2005 Team Foundation Server\Tools

    • Drive:\%ProgramFiles%\Microsoft Visual Studio 2008 Team Foundation Server\Tools

  3. Type the following command, and then press ENTER:

    TFSAdminUtil ChangeAccount oldAccount newAccount newPassword

    You must type the user name for the old service account (oldAccount), in addition to the user name and password for the new account (newAccount and newPassword).

See Also

Tasks

A service account is not configured correctly

A service is not running

An application pool is not configured correctly

Other Resources

Issues That Relate to the Application Tier for Team Foundation