【发布时间】:2019-06-15 18:20:35
【问题描述】:
我可以使用
从 SSMS 正常登录数据库localhost\MSSQLSERVER01
用户名:DOMAIN\user.name(Windows 身份验证)
但是当我尝试从我的应用程序连接时,我得到了
Error Number:18456,State:1,Class:14
Login failed for user 'DOMAIN\User.Name'.
即使我的帐户可以访问 SSMS 中的数据库并具有系统管理员权限。
查看 SQL 日志,每当登录失败时,我都会看到此消息:
2019-01-22 09:46:42.13 Logon Login failed for user 'DOMAIN\User.Name'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]
2019-01-22 09:48:33.74 Logon Error: 18456, Severity: 14, State: 5.
我尝试将NT AUTHORIRTY\NETWORK SERVICE 添加到/server/security/logins 和/server/database/security/users,但没有任何区别
为什么会发生这种情况,或者当错误消息基本上没有给我任何信息时,我该如何调试?
连接字符串:
Server=localhost; Database=dbname; Trusted_Connection=True;MultipleActiveResultSets=true;
但我也试过
Server=localhost\\MSSQLSERVER01; Database=dbname; Trusted_Connection=True;MultipleActiveResultSets=true;
结果相同
【问题讨论】:
-
你能显示你的连接字符串吗?
-
Windows 事件查看器是否记录此内容?不确定是不是。
-
@Gaurav 我把它添加到我的问题中
-
您缺少 Integrated Security = true 请添加。
标签: c# ssms sql-server-2017