微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何解决“用户'NT AUTHORITY\SYSTEM'登录失败原因:无法打开明确指定的数据库'TestTable1'”?

如何解决如何解决“用户'NT AUTHORITY\SYSTEM'登录失败原因:无法打开明确指定的数据库'TestTable1'”?

我正在开发与一些 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,DbConnection owningConnection,DbConnectionoptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool,DbConnection owningObject,DbConnectionoptions options,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,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,sqlAuthenticationProviderManager sqlAuthProviderManager)
   at System.Data.sqlClient.sqlConnectionFactory.CreateConnectio...

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

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

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。