I have created a web application. I am using SQL 2012 express as a database. Its working fine when I am running on debug mode. When I deployed that application on local IIS it's throwing an error
Cannot open database "databaseName" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\MyApplicationName'.
My connection string is <add name="DefaultConnection" connectionString="Data Source=HAPPY\SQLEXPRESS;uid=sa;password=123;Initial Catalog=dwm;integrated security=sspi;" providerName="System.Data.SqlClient" />
I am able to login with this login detail on my SQL 2012 express. I am attaching a screenshot .
Best Answer
You are using
SSPI
Integrated Security, thus it is trying to use Windows authentication. Try setting toFalse
: