且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法打开数据库“db”登录请求。登录失败。用户'nt authority\\\
etwork service'登录失败。

更新时间:2022-06-08 09:11:36

这意味着您的代码作为帐户NT AUTHORITY \ NETWORK SERVICE运行。这是因为在IIS中,您的应用程序池的标识设置为NT AUTHORITY \ NETWORK SERVICE,并且您的web.config使用可信连接。



我建议创建一个sql帐户,然后更改您的连接字符串以使用该帐户。或者,您可以按照博客文章的建议进行操作,并授予NT AUTHORITY \ NETWORK SERVICE适当的安全权限。
This means that your code is running as the account NT AUTHORITY\NETWORK SERVICE. This is because in IIS your application pool's identity is set to NT AUTHORITY\NETWORK SERVICE and your web.config is using a trusted connection.

I recommend creating a sql account and then changing your connection string to use that account. Or, you can do as the blog post suggest and grant NT AUTHORITY\NETWORK SERVICE the proper security rights.