简体   繁体   English

为IIS APPPOOL创建SQL Server登录 - 在不同的计算机上创建IIS和SQL Server

[英]Create SQL Server Login for IIS APPPOOL - IIS and SQL Server on different machines

I've searched thoroughly- apologies in advance if I am missing an obvious answer. 如果我错过了一个明显的答案,我会提前彻底搜索道歉。 Followed the recommendations at link below and the solution did not work. 遵循以下链接中的建议,解决方案无效。 The solution also does not indicate whether it applies to a production webserver running IIS and SQL Server on separate computers. 该解决方案也不表示它是否适用于在不同计算机上运行IIS和SQL Server的生产Web服务器。 Add IIS 7 AppPool Identities as SQL Server Logons 将IIS 7 AppPool标识添加为SQL Server登录

Microsoft link below does not provide specific syntax for creating a SQL Server Windows Login: http://www.iis.net/learn/manage/configuring-security/application-pool-identities 下面的Microsoft链接未提供用于创建SQL Server Windows登录的特定语法: http//www.iis.net/learn/manage/configuring-security/application-pool-identities

Our goal is to securely deploy a ASP.NET 4.0 web application to the public on a Server 2008 R2 computer running IIS 7.5 in our production environment. 我们的目标是在生产环境中运行IIS 7.5的Server 2008 R2计算机上公开部署ASP.NET 4.0 Web应用程序。 As per best practices, we have SQL Server 2008 running on a separate computer in the same domain. 根据最佳实践,我们在同一域中的单独计算机上运行SQL Server 2008。 We want to use SQL Sever Windows Authentication without impersonation to allow the ASP.NET application on the IIS box and SQL Server to communicate. 我们希望在没有模拟的情况下使用SQL Sever Windows身份验证,以允许IIS框和SQL Server上的ASP.NET应用程序进行通信。 Currently a SQL Server login connection string allows the .NET app to connect to SQL Server but we want to upgrade the connection string to be a Windows SQL Server login to be more secure. 目前,SQL Server登录连接字符串允许.NET应用程序连接到SQL Server,但我们希望将连接字符串升级为Windows SQL Server登录以更安全。

On IIS 7.5 we've configured an Application Pool for the website. 在IIS 7.5上,我们为网站配置了一个应用程序池。 Under Application Pool advanced setting, Built-In Account have tried using both ApplicationPoolIdentity and Network service without success. 在“应用程序池高级”设置下,“内置帐户”已尝试同时使用ApplicationPoolIdentity和网络服务。 Best practice is said to be to use ApplicationPoolIdentity for tighter security. 据说最佳做法是使用ApplicationPoolIdentity来实现更严格的安全性。

The step that fails is creating a SQL Server Windows login. 失败的步骤是创建SQL Server Windows登录。

We've followed the following steps per the first link: 我们按照第一个链接执行了以下步骤:

  1. In SQL Server Management Studio, look for the Security folder (the security folder at the same level as the Databases, Server Objects, etc. folders...not the security folder within each individual database) 在SQL Server Management Studio中,查找Security文件夹(与数据库,服务器对象等文件夹处于同一级别的安全性文件夹...而不是每个单独数据库中的安全性文件夹)

  2. Right click logins and select "New Login" 右键单击登录并选择“新登录”

  3. In the Login name field, type IIS APPPOOL\\YourAppPoolName - do not click search 在“登录名”字段中,键入IIS APPPOOL\\YourAppPoolName - 不要单击“搜索”

  4. Fill whatever other values you like (ie, authentication type, default database, etc.) 填写您喜欢的任何其他值(即身份验证类型,默认数据库等)

  5. Click OK 单击确定

Can you please tell me with IIS 7.5 and SQL Server being on separate boxes, what syntax I need to use to create the SQL Server Window Login? 你能告诉我IIS 7.5和SQL Server在不同的盒子上,我需要用什么语法来创建SQL Server窗口登录?

I have tried: " mydomain\\machine1$\\IIS APPPOOL\\MyAppPoolName " many times without success. 我试过:“ mydomain\\machine1$\\IIS APPPOOL\\MyAppPoolName ”多次没有成功。
Error message is: " Windows NT User or group IIS APPPOOL\\MyAppPoolName can not be found " 错误消息是:“ Windows NT User or group IIS APPPOOL\\MyAppPoolName can not be found

I have used the network name of the webserver in place of machine1 (along with the actual app pool name, and domain name). 我使用了网络服务器的网络名称来代替machine1(以及实际的应用程序池名称和域名)。

Thanks in advance for your help. 在此先感谢您的帮助。

PS It would be great if Microsoft provided a step by step tutorial on how to accomplish this common and what should be easy task. PS如果微软提供了一个关于如何完成这个常见以及应该是简单任务的分步教程,那将是很好的。 Your answers here on StackOverFlow will help many people :) 你在StackOverFlow上的答案将帮助很多人:)

One solution to your problem would be to set up a separate (not built-in) account for the application pool. 您的问题的一个解决方案是为应用程序池设置一个单独的(非内置)帐户。 You could give that account minimal rights and also give the access to SQL Server. 您可以为该帐户授予最小权限,并授予对SQL Server的访问权限。

This way you could use a domain account which is easy to set up but still control security tightly. 这样您就可以使用易于设置但仍能严格控制安全性的域帐户。

I know this question is old, but since I suffered till I got it work, I'd like to share my experience to answer this question. 我知道这个问题已经过时了,但是直到我开始工作,我才愿意分享我的经验来回答这个问题。

The steps you have followed worked with me, except : 您遵循的步骤与我合作,除了:

3- The account you need to add to sql server logins is mydomain\\machine1$ not mydomain\\machine1$\\IIS APPPOOL\\MyAppPoolName 3-需要添加到sql server登录的帐户是mydomain\\machine1$ not mydomain\\machine1$\\IIS APPPOOL\\MyAppPoolName

4- leave every thing in general settings page as defaults (actually, you need to make sure you are using windows authentication). 4-将常规设置页面中的所有内容保留为默认值(实际上,您需要确保使用Windows身份验证)。

Then Go to User Mappings | 然后转到User Mappings | select the database you want your application to access | 选择您希望应用程序访问的数据库 grant it whatever permissions you want. 授予它你想要的任何权限。 For example, give it db_datareader & db_datawriter permissions. 例如,给它db_datareader和db_datawriter权限。

5- Click OK to save. 5-单击“确定”保存。

But be ware that all applications using virtual accounts from same machine will be able to access this database. 但是要知道使用来自同一台机器的虚拟帐户的所有应用程序都能够访问该数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM