I can log into the db fine from SSMS with
localhost\MSSQLSERVER01
username: DOMAIN\user.name (Windows Authentication)
But when I try connecting from my application I get
Error Number:18456,State:1,Class:14
Login failed for user 'DOMAIN\User.Name'.
Even though my account can access the db in SSMS and has sysadmin permissions.
Checking the SQL log, I can see this message whenever the login fails:
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.
I tried adding NT AUTHORIRTY\NETWORK SERVICE to both /server/security/logins as well as /server/database/security/users but it made no difference
Why is this happening, or how can I possible debug this when the error message gives me basically no information?
The connection string:
Server=localhost; Database=dbname; Trusted_Connection=True;MultipleActiveResultSets=true;
But I also tried
Server=localhost\\MSSQLSERVER01; Database=dbname; Trusted_Connection=True;MultipleActiveResultSets=true;
with the same results