[英]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 SERVICE
, LocalDb
用户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. 我遵循了本指南,但是使用了
LocalDb
和NT AUTHORITY\\LOCAL SERVICE
。
https://stackoverflow.com/a/3678481/3850405 https://stackoverflow.com/a/3678481/3850405
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.