IIS permissions for data base access

When I try to access my SQLExpress database using a .NET web page I get the following error:

Cannot open database <dbname> requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\.NET v4.5'

This started happening after I updated the database. Before the update everything connected without issue.

.NET v4.5 has cull control of the folder containing the database, the mdf file, and the log file.

Any suggestions what I have wrong?

Thanks,
Doug
OhioWoodWrightAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
Granting web application access to database files is dangerous, insecure, and unnecessary.
Database can be accessed using MSSQL interface, and the user should be allowed to select from tables on MSSQL, and all mdb files should be owned by MSSQL server user.
Dan McFaddenSystems EngineerCommented:
What's happening is that the application is using the AppPool's identity to try to access your database instance.  You should be using either a domain account or SQL account which has been granted permissions to connect to and use the database.

Usually this is accomplished 1 of 2 ways:

1. you create a service account for the AppPool and grant that service account database access
2. you config the database connection string in the web.config to use a specific user account when your app tries to make a connection to the db.

Dan

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kadadi_vIT AdminCommented:
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Vitor MontalvãoMSSQL Senior EngineerCommented:
This started happening after I updated the database.
Which update did you perform?
OhioWoodWrightAuthor Commented:
I also needed to Configure sql server to accept both Windows and sql logins
gheistCommented:
One should be sufficient.
You probably use 2 SQL pools unintentionally.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.