When I run my website from Visual Studio it all works fine. Now I am trying to move forward and start testing the multi tenancy part, so I had to move my website to IIS.
For some reason I can’t get access to the database. The error I get when I open a page that requires database access is:
Cannot open database “GWD” requested by the login. The login failed.
Login failed for user ‘IIS APPPOOL\gwd’.Exception Details: System.Data.SqlClient.SqlException: Cannot open
database “GWD” requested by the login. The login failed. Login failed
for user ‘IIS APPPOOL\gwd’.
Another forum describes how to add NT AUTHORITY\NETWORK SERVICE. But that doesn’t resolve the issue. I did create the NT AUTHORITY\NETWORK SERVICE and added the dbowner for all existing databases (including master) but no result.
I am out of ideas, can anybody help?
You’ll need to change the application pool identity to
NETWORK SERVICEas well. Fire up Internet Information Services (IIS) Manager, drill down to Application Pools, and select the Application Pool that you’re using. (Not sure? Drill down to your virtual directory under Sites on the left side and then click Basic Settings on the right.) Then click your Application Pool, click Advanced Settings, and then change Identity under Process Model to NetworkService.In SQL Server Management Studio, you’ll need to add the
NT AUTHORITY\NETWORK SERVICEuser under Security for your database, but it sounds like you already did that.