Search code examples
tfs

TFS246017: Team Foundation Server could not connect to the database


While attempting Branch operation from within VS I get the error message TFS246017: Team Foundation Server could not connect to the database. Verify that the instance is specified correctly, that the server that is hosting the database is operational, and that network problems are not blocking communication with the server. (The error message box looks like the one in this question).

I logged on to the TFS virtual machine. In event viewer I see a warnning with with the same message as above + Process Name: w3wp, User: domain\MyUser. The IIS TFS site is started.

I opened the TFS console on the TFS machine using both domain\MyUser and domain\tfssetup (this is the user running the Visual Studio Team Foundation Background Job agent service), the console opens successfully. Both users appear in the Administration Console Users list. I did reapply account for both users. I also did update password for domain\MyUser. It shows a connection string with Datasource and Initial Catalog. I logged in to the DB machine, opened SQLSERVER users: the tfssetup user is there with sysadmin and owner of relevant instances. I also added the domain\MyUser and added admin privileges (but the error persists).

I also installed SSMS on TFS machine & was able to connect to DB server using both domain\MyUser and domain\tfssetup and view tables.

This error did not happen in the past. This error didn't happen when branching a different location in the source control ($/Project1/Main vs $/Project2/Main) beforehand. The Source Control Explorer appears to show OK (so TFS is working). Using Visual Studio 2013. TFS 2017. AFAIK Virtual Machines were not moved, IP address were not changed. Using vSphere it seems there is enough disk space for both TFS and DB machines. The error appears after ~4 seconds.

What else can be tried?


Solution

  • Looking in the TFS SQLSERVER log there was a "SERVER ASSERTION" error and this was the cause for the TFS generic error.

    In my case the error was very similiar to the one here. CHECKDB and updating to the latest service pack didn't help. What helped was changing the recovery mode to full as recommended in that thread.