简体   繁体   English

LocalDb-> Windows服务->无法打开登录请求的数据库“”。 登录失败。 用户“ NT AUTHORITY \\ LOCAL SERVICE”的登录失败

[英]LocalDb -> Windows Service -> Cannot open database “” requested by the login. The login failed. Login failed for user 'NT AUTHORITY\LOCAL SERVICE'

I have a problem connecting to LocalDb using the LOCAL SERVICE account. 我使用LOCAL SERVICE帐户连接到LocalDb遇到问题。

Cannot open database "MyDB" requested by the login. 无法打开登录请求的数据库“ MyDB”。 The login failed. 登录失败。 Login failed for user 'NT AUTHORITY\\LOCAL SERVICE'. 用户“ NT AUTHORITY \\ LOCAL SERVICE”的登录失败。

The service looks like this: 该服务如下所示:

在此处输入图片说明

connectionString: ConnectionString的:

Server=(localdb)\mssqllocaldb;Database=MyDB;Trusted_Connection=True;MultipleActiveResultSets=true

I have created the user NT AUTHORITY\\LOCAL SERVICE in LocalDb and mapped the user as db_owner to the current databases. 我在LocalDb创建了用户NT AUTHORITY\\LOCAL SERVICELocalDb用户db_owner映射到当前数据库。 I have also checked that the login is enabled and has permission to connect to the database engine. 我还检查了登录名是否已启用,并具有连接到数据库引擎的权限。 I have also tried granting the user the sysadmin server role. 我也尝试过授予用户sysadmin服务器角色。

在此处输入图片说明

I have restarted both the service and the computer but I still get the same error. 我已经重新启动了服务和计算机,但是仍然出现相同的错误。

If I change the service to use my local computer account everything works. 如果我将服务更改为使用本地计算机帐户,则一切正常。 What have I missed? 我错过了什么?

I have followed this guide but with LocalDb and NT AUTHORITY\\LOCAL SERVICE instead. 我遵循了本指南,但是使用了LocalDbNT AUTHORITY\\LOCAL SERVICE

https://stackoverflow.com/a/3678481/3850405 https://stackoverflow.com/a/3678481/3850405

Local Service account is not supported for the SQL Server or SQL Server Agent services. SQL Server或SQL Server代理服务不支持本地服务帐户。 Instead, use a domain account or local account with the most restrictive permission set. 而是使用设置了限制性最强的权限的域帐户或本地帐户。

See this . 看到这个

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法打开登录请求的数据库。 登录失败。 用户“ NT AUTHORITY \\ SYSTEM”的登录失败 - Cannot open database requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM' SqlException:无法打开登录请求的数据库“ path \\ db.mdf”。 登录失败。 用户“ NT AUTHORITY \\ SYSTEM”的登录失败 - SqlException: Cannot open database “path\db.mdf” requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM' 无法打开登录请求的数据库。 用户“NT AUTHORITY\\SYSTEM”登录失败。 Quartz 调度程序 Windows 服务 - Cannot open database requested by the login. Login failed for user 'NT AUTHORITY\SYSTEM'. Quartz Scheduler Windows Services 无法打开登录请求的数据库“dbTest”。 登录失败。 窗口服务 - Cannot open database "dbTest" requested by the login. The login failed. windows service 无法打开登录请求的数据库“ [数据库]”。 登录失败。 用户“ [User]”的登录失败 - Cannot open database “[Database]” requested by the login. The login failed. Login failed for user '[User]" 无法打开登录请求的数据库“身份”。 登录失败。 用户“DESKTOP\User”登录失败 - Cannot open database “Identity” requested by the login. The login failed. Login failed for user 'DESKTOP\User' 无法打开登录请求的数据库“MyBase”。 登录失败。 用户“域\用户”登录失败 - Cannot open database "MyBase" requested by the login. The login failed. Login failed for user 'domain\User' 无法打开登录请求的数据库“ Inventory_New”。 登录失败。 用户“ sa”的登录失败 - Cannot open database “Inventory_New” requested by the login. The login failed. Login failed for user 'sa' 无法打开登录请求的数据库“ ASPState”。 登录失败。 用户“ xxxx”的登录失败 - Cannot open database “ASPState” requested by the login. The login failed. Login failed for user 'xxxx' 无法打开登录请求的数据库“test”。 登录失败。 用户 'Domain\\userid' 登录失败 - Cannot open database "test" requested by the login. The login failed. Login failed for user 'Domain\userid'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM