Question

I have an ASP NET APP that's trying to access a sql server database, when I run it, I get an error saying

"Login Failed for user IIS APPPOOL\DefaultAppPool"

Searching the web I found that I should grant access to this user, so I executed the following script:

grant  execute on schema :: dbo to [IIS APPPOOL\DefaultAppPool]

It executed succesfully as a script for my database, but I still get the "Login Failed" error.

What's missing?

Was it helpful?

Solution

Check the user your DefaultAppPool is using to connect.

On your IIS manager check DefaultAppPool advanced properties and look for Identity. You need to give it a user with enough privileges, depending on what your site is going to do.

I usually create different AppPools for different sites depending on what they will do, for example, if your app will write documents to a folder on your server, the user of the AppPool will need writing access to that folder.

Also is not a good idea to use an administrator user, as it could lead to potential security breaches. However it could be a good way to check if your problem comes from there.

OTHER TIPS

I think I already know what it is. When I upgraded SQL Server Express, it installed a new server .\SQLEXPRESS (because I used "new sql instance"), remote connections where configured in this server and not LocalDB, my database was still in LocalDB. But now I get other error, maybe related to WCF Data Services...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top