How to resolve "Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database 'TestTable1'"?

0

I'm developing a VB.NET windows service which connects with some SQL databases. When I try to start the windows service it throws me these errors in the windows event viewer.

ERROR 1

Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'EDGEMAN\STLWKSENG11$'.
   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 us...

ERROR 2

Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): Cannot open database "TestTable1" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
   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, DbCo...

I have researched about this errors and read bunch of articles about giving permissions and gave almost all the permissions and tried doing almost every method what they were saying, no luck.

Furthermore detailed version of what I've tried : First I've tried to connect the network databases and then it gave me the below error

Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
   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.CreateConnectio...

Since I thought maybe the issue is with network, I tried to connect local databases just to make sure nothings wrong with the code I wrote. Ended up with the Error1, Error2 which shown above.

SQL Server Logs throws this message : Login failed for user 'EDGEMAN\STLWKSENG11$'. Reason: Could not find a login matching the name provided. [CLIENT: 10.0.15.118]

Appreciate very much your time and consideration all!

sql-server
vb.net
windows-services
event-viewer
sql-server-config-manager
asked on Stack Overflow Apr 8, 2021 by Ashan Glenn • edited Apr 8, 2021 by Ashan Glenn

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0