简体   繁体   中英

Service account to access SQL server from IIS

My Asp.Net/C# web app hosted on IIS is using 2 different service accounts to access 2 DBs on 2 SQL servers on the network. IIS is running as service account1 coonnecting to DB1 on SQL server1.

I have the User ID, Password for account 2 configured in the web.config connectionstring expecting this to supersede the IIS setting just for DB2 on SQL server2. This is not working. Is there a better way to handle this? Appreciate your help.

Obviously, DB1 uses Windows Authentication and should be configured for that. Make sure, the connection string is configured to select "Integrated Security=true;" in its connection string. DB2 needs SQLServerAuthentication enabled. No impersonation will work for DB2 but a regular connection string will do:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

See also: http://www.connectionstrings.com/sql-server-2008

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM