I have a web app hosted in IIS7 and I have set the appPool to run as administrator. Now if the user logs in (form authentication), the IIS will use administrator account (in the appPool) to access the database however if the user does not log in then IIS will use ‘NT AUTHORITY\IUSR’ account which is causing an error: Login failed for user ‘NT AUTHORITY\IUSR’.
can anyone please explain why it is not using the administrator account while the user does not login?
I can’t verify that it’s correct what you’re saying but i can tell you how you should do it.
1) The AppPool user should have the least permissions possible, certainly not administrator permission. It’s best to leave the AppPool user to the default NETWORK SERVICE unless you really know what you’re doing.
2) You should create a user on your database, again with the least needed permissions, and use that user in the ConnectionString in your web.config.