TeamCity: SQL exception: Cannot open database – 500 Internal Server Error

The Scenario

I rebooted my TeamCity server following updates.

The Problem

When I start the TeamCity agents they report a 500 Internal Server Error and the login page (http://teamcity-server:8080) reports the error:

SQL exception: Cannot open database requested by the login. The login failed. ClientConnectionId:f17b1159-b183-4241-bc98-c119d1767b49

The Solution

The issue is that the TeamCity Server service is starting and requesting database access before the MSSQL services are ready.

Quick Fix: Restart the TeamCity Server service (sc stop teamcity && sc start teamcity)

Long-term Fix: Change the TeamCity Server service startup type from Automatic to Automatic (Delayed) (sc config teamcity start= delayed-auto)

 

Disclaimer: provided “AS IS” with no warranties and confer no rights

1 thought on “TeamCity: SQL exception: Cannot open database – 500 Internal Server Error

Leave a comment