关于 SQL Server 安全性
我有一个 ASP.NET 应用程序,它在 IIS 中的 Classic .NET AppPool 下运行。
我要从我的网站提供一份报告。
问题是 SQL Server 不断告诉我它无法创建与数据源的连接,因为用户 IUSR 登录失败。
将该用户直接添加到数据库后,我可以使报告正常工作,但我担心安全性。
通过这样做,我是否可以向 IIS 上托管的所有网站开放指定的数据库?或者该帐户是否特定于身份?
I have an ASP.NET application which runs under the Classic .NET AppPool in IIS.
I have a report to render from my website.
The problem is SQL Server keeps telling me that it failed to create a connection to the datasource, because login failed for user IUSR.
After adding that user directly to the databse I could get the report to work, but I'm concerned about security.
By doing that, am I opening my specified databases to all websites hosted on IIS? Or is that account identity-specific?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更好的方法是将应用程序池标识更改为特定用户并将该用户添加到数据库中,否则您将授予标准 IIS 匿名用户对数据库的访问权限。
A better way to so it would be to change the application pool identity to a specific user and add that user to the database, otherwise you are giving the standard IIS anonymous user access to the database.
您正在使用
Windows 身份验证
。您可以使用Sql Server 身份验证
,这样您就可以独立于客户端应用程序的当前用户。您应该使用应用程序所需的凭据创建一个 sql server 用户,并在连接字符串上像这样使用它。You're using
Windows Authentication
. You could useSql Server authentication
so you're independent of the current user of your client application. You should have a sql server user created with just the necessary credentials for your application and use it like this on the connection string.