My auto-starting Windows Service written in C# depends on MS SQL Server and uses Integrated Security=SSPI
In the Installer I'm stating
this.serviceInstaller.ServicesDependedOn = new string[] {"MSSQLSERVER"};
Unfortunately, during auto-startup my service throws the exception:
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "*" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM'.
if I however start it manually later, it works correctly - connects to the database and works on it.
Why is that happening?