I have a connection string that looks like this:
Server=.;Database=mydbname;Trusted_Connection=True;
This works fine when I run/debug my application using Visual Studio (IIS Express) but after deployment over IIS-8 it throws me an exception while opening connection that:
Login failed for user 'IIS APPPOOL\mysite'.
I am confused why this is happening why IIS is adding its user in the middle when the database doesn't require one, and why this is not happening with IIS Express?
You're using Trusted_Connection=True and thus the user ApplicationPoolIdentity or IIS APPPOOL\mysite is supplied to SQL server.
Option 1. Give permissions to IIS APPPOOL\mysite in SQL server.
Option 2. Use User Id=User_Id;Password=****** instead of Trusted_Connection=True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With