I created a Windows service in Visual Studio 2019. The service works just fine in Visual Studio, but when I deploy it to my local system, the service is now unable to connect to the SQL Server database.
I get this error:
Description: Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'GLOADMIN'.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
I was initially using Windows authentication, before I changed to SQL Server authentication, both worked in Visual Studio but after deployment as a service on my local Windows 10 system, it fails.