5

How can I grant permissions to log in and access the AdventureWorks database from the IIS?

I'm developing an application in Visual Studio 2010 (Silverlight hosted in the IIS) and I get an error saying that it couldn't open the AdventureWorks database since login failed for user IIS APPPOOL\ASP .NET 4.0.

JohnFx
  • 34,542
  • 18
  • 104
  • 162
Rafael
  • 2,413
  • 4
  • 32
  • 54

1 Answers1

3

Use SQL Server Management Studio.

  1. Create a windows Login in SQL Server for IIS AppPool\{YourApplicationPoolName}
  2. Add this login to your database
  3. Give permissions to the account in the DB as needed.
JohnFx
  • 34,542
  • 18
  • 104
  • 162
  • 2
    I don't know how to create the login. In SQL Server Management Studio I try to create the Login "IIS AppPool\SLAppFromIIS" in the Security folder and it fails saying that user of group "IIS AppPool\SLAppFromIIS" was not found. SLAppFromIIS is my app name, but you say AppPoolName, I guess it's not the same. I'm stuck in this step. – Rafael Feb 03 '13 at 16:02
  • You might want to try the documentation at this point. – JohnFx Feb 03 '13 at 20:26
  • Now I guess that the AppPoolName is ASP.NET v4.0, but SSMS doesn't let me to create the login, it keeps saying that the user IIS APPPOOL\ASP .NET 4.0 was not found. I enabled ASP impersonation and allowed remote connections in SQL SERVER, how do I proceed? – Rafael Feb 04 '13 at 13:40
  • 3
    Found a complete solution, for those interested please see: http://stackoverflow.com/questions/7698286/login-failed-for-user-iis-apppool-asp-net-v4-0 – Rafael Feb 04 '13 at 15:02