I published a web service on a server and this web service is trying to connect to the sql server which is on the same server. This is my connection string:
Data Source=........\sqlexpress; Initial Catalog =mybooks; User Id =......; Password =......; Integrated Security=SSPI
I want to connect to sql using a sql user account so I used SSPI.
I created an app pool "mypool" for the service, runs under ApplicationPoolIdentity built-in account.
Web service gives error:
System.Data.SqlClient.SqlException: Cannot open database "mybooks" requested by the login. The login failed. Login failed for user "IIS APPPOOL\mypool"
Thanks for any help
Since you are using SSPI which means Integrated Security = true;
So your windows credentials will be used to authenticate to the sql-server. Not your sql-server username/password. (In your case, the user specified under application pool or web server process)
Just use sql-server username/password and do not use integrated security. Your username/password will be ignored when SSPI is used.
Hope that helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.