SQL Server Login error: Login failed for user 'NT AUTHORITY\SYSTEM'

There is another fix. You should open Command Prompt (cmd) and write the following:

sqlcmd -S (server name)

select name from sys.server_principals where name = 'NT AUTHORITY\SYSTEM'

go

SP_ADDSRVROLEMEMBER 'NT AUTHORITY\SYSTEM','SYSADMIN'

go

The first line will give you an access to the sql server on you machine, the second will take the following result NT AUTHORITY\SYSTEM an the stored procedure addsrvrolemember will add sysadmin to it. Be careful, because you have to type the following code the way it is.


I tweaked the application settings a lot, changing the application pool's identity (in Windows 8.1's IIS) to LocalSystem, LocalService, NetworkService, and ApplicationPoolIdentity. However, all of them failed to solve the problem I had logging into my database.
Finally I set the pool identity on LocalSystem and thought why it might be preventing "NT AUTHRITY\SYSTEM" from opening a connection to my database. I opened up SQL Server Management Studio as "Administrator" and checked the Server Roles for NT AUTHORITY\SYSTEM under "logins" section. The default server role for this user was public by default. I also checked sysadmin and refreshed my web application form. This time it worked! Everything working perfectly now.


Allow NT AUTHORITY/SYSTEM to server Role as sysadmin. enter image description here

enter image description here