SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

时间:2021-11-14 00:11:05

I have created an application pool called "schoolPool" and assigned it to my web application. Identity for this pool has been set to LocalSystem. When I try to access my database from within the application, i.e. open a SQL connection, I get the following error all the time:

我创建了一个名为“schoolPool”的应用程序池,并将其分配给我的Web应用程序。此池的标识已设置为LocalSystem。当我尝试从应用程序中访问我的数据库,即打开SQL连接时,我始终收到以下错误:

Login failed for user 'NT AUTHORITY\SYSTEM'


I tried to add NT AUTHORITY/SYSTEM to SSMS (SQL Server Management Studio) logins, but it was already a principal, showing the following error:
SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

我尝试将NT AUTHORITY / SYSTEM添加到SSMS(SQL Server Management Studio)登录,但它已经是一个主体,显示以下错误:

4 个解决方案

#1


78  

Allow NT AUTHORITY/SYSTEM to server Role as sysadmin. SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

允许NT AUTHORITY / SYSTEM将服务器角色作为sysadmin。

SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

#2


39  

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 the user "Administrator" and checked out 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 was a success. Great job!

我经常调整应用程序设置,将应用程序池的标识(在Windows 8.1的IIS中)更改为LocalSystem,LocalService,NetworkService和ApplicationPoolIdentity。但是,所有这些都无法解决我登录数据库的问题。最后,我在LocalSystem上设置池标识,并考虑为什么它可能阻止“NT AUTHRITY \ SYSTEM”打开与我的数据库的连接。我以用户“Administrator”的身份打开了SQL Server Management Studio,并在“登录”部分下检查了NT AUTHORITY \ SYSTEM的服务器角色。默认情况下,此用户的默认服务器角色是公共的。我还检查了sysadmin并刷新了我的Web应用程序表单。这次是成功的。做得好!

#3


2  

Musakkhir's answer of granting sysadmin seems poorly thought out as far as security goes, and Pinal's answer involved giving the unknown process db_owner rights, still almost certainly overkill. I've 'solved' it myself by simply granting "public" rights, which normally just allows CONNECT, but nothing else, even SELECT. If gets rid of the login error and stops flooding the error log, since it now logs in, but whatever unknown process is doing the connecting still can't do anything.

就安全问题而言,Musakkhir给予系统管理员的回答似乎很少考虑,Pinal的答案涉及给予未知进程db_owner权限,但几乎肯定是矫枉过正。我通过简单地授予“公共”权利来“解决”它,这通常只允许CONNECT,但没有别的,甚至是SELECT。如果摆脱登录错误并停止充斥错误日志,因为它现在登录,但无论进行什么未知进程,连接仍然无法做任何事情。

#4


2  

Rerun following query which will assign 'NT SERVICE\MSSQLSERVER' to sysadmin

重新运行以下查询,将“NT SERVICE \ MSSQLSERVER”分配给sysadmin

EXEC master..sp_addsrvrolemember @loginame = N'NT SERVICE\MSSQLSERVER', @rolename = N'sysadmin'

#1


78  

Allow NT AUTHORITY/SYSTEM to server Role as sysadmin. SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

允许NT AUTHORITY / SYSTEM将服务器角色作为sysadmin。

SQL Server登录错误:用户'NT AUTHORITY \ SYSTEM'登录失败

#2


39  

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 the user "Administrator" and checked out 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 was a success. Great job!

我经常调整应用程序设置,将应用程序池的标识(在Windows 8.1的IIS中)更改为LocalSystem,LocalService,NetworkService和ApplicationPoolIdentity。但是,所有这些都无法解决我登录数据库的问题。最后,我在LocalSystem上设置池标识,并考虑为什么它可能阻止“NT AUTHRITY \ SYSTEM”打开与我的数据库的连接。我以用户“Administrator”的身份打开了SQL Server Management Studio,并在“登录”部分下检查了NT AUTHORITY \ SYSTEM的服务器角色。默认情况下,此用户的默认服务器角色是公共的。我还检查了sysadmin并刷新了我的Web应用程序表单。这次是成功的。做得好!

#3


2  

Musakkhir's answer of granting sysadmin seems poorly thought out as far as security goes, and Pinal's answer involved giving the unknown process db_owner rights, still almost certainly overkill. I've 'solved' it myself by simply granting "public" rights, which normally just allows CONNECT, but nothing else, even SELECT. If gets rid of the login error and stops flooding the error log, since it now logs in, but whatever unknown process is doing the connecting still can't do anything.

就安全问题而言,Musakkhir给予系统管理员的回答似乎很少考虑,Pinal的答案涉及给予未知进程db_owner权限,但几乎肯定是矫枉过正。我通过简单地授予“公共”权利来“解决”它,这通常只允许CONNECT,但没有别的,甚至是SELECT。如果摆脱登录错误并停止充斥错误日志,因为它现在登录,但无论进行什么未知进程,连接仍然无法做任何事情。

#4


2  

Rerun following query which will assign 'NT SERVICE\MSSQLSERVER' to sysadmin

重新运行以下查询,将“NT SERVICE \ MSSQLSERVER”分配给sysadmin

EXEC master..sp_addsrvrolemember @loginame = N'NT SERVICE\MSSQLSERVER', @rolename = N'sysadmin'