0

我正在开发一个与一些 SQL 数据库连接的 VB.NET Windows 服务。当我尝试启动 Windows 服务时,它会在 Windows 事件查看器中抛出这些错误。

错误 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...

错误 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...

我已经研究了这个错误并阅读了一堆关于授予权限的文章,并给出了几乎所有的权限,并尝试按照他们所说的几乎每一种方法,没有运气。

我尝试过的更详细的版本:首先我尝试连接网络数据库,然后它给了我以下错误

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...

因为我认为问题可能出在网络上,所以我尝试连接本地数据库,以确保我编写的代码没有问题。以上面显示的Error1、Error2 结束

SQL Server 日志抛出此消息: 用户“EDGEMAN\STLWKSENG11$”登录失败。原因:找不到与提供的名称匹配的登录名。[客户:10.0.15.118]

非常感谢您的时间和考虑!

4

0 回答 0