Hi everyone,
I am a bit new to .NET and IIS 5.0-6.0. We are developing Web Application, developers having loacal IIS 5.1 and SQL server 2005 on same machine, web.config have connection string with <connectionString="Data Source=D103A;Initial Catalog=enRouteV3.SLM;Integrated Security=True"> and on IIS, the virtual directory has "Directory Security" setting as "Intergrated Windows Authetication". It was working OK.
When DB server and IIS moved to two different machine, not in common domain, infect both are independent Windows 2003 R2 servers, a mirror account was created with same id and password on both machine, and connectionString in web.config configured as <connectionString="Data Source=DBX;Initial Catalog=enRouteV3.SLM;Trusted_Connection=Yes"> and on IIS, the virtual directory has "Directory Security" setting as "Integrated Windows Authentication". It is working OK.
Now we have problem, during regular aspx page processing, the code behind method create a new Thread using <Thread thread = new Thread(new ThreadStart(csmd.StartConsolidation)); thread.Start();>. The new thread need to connec to DB to process some records, it was running OK when both IIS and DB was on same server, but now when we moved IIS and DB on different machine, application is running fine but when this new thread tries to connect open connection with DB, it is giving error: <Login failed for user ''.The user is not associated with a trusted Sql Server Connection>.
Pleas note, ASP.NET application is running/accessing DB but only this new thread is unable to connect to DB. An early response will be appreciated.
Thanks.
Asad.
![]() |
0 |
![]() |
I had exactly the same problem. I found 2 solutions for this. I am not sure whether they will work for you.
1. If the database is hosted in a different server that the web application "Integrated Security=True" will not work. This will work only if the SQL database and web application are in the same server. You will have to create an SQL user and add the user credentials to the connection.
(I may be wrong in this. But this is what worked for me.)
So the connection should be :
<add name="LocalSqlServer" connectionString="Data Source=myservername;Password=mypassword;User ID=myuser;Initial Catalog=aspnetdb"
providerName="System.Data.SqlClient" />
<add name="myConnectionString" connectionString="Data Source=myservername;Password=mypassword;User ID=myuser;Initial Catalog=aspnetdb"
providerName="System.Data.SqlClient" />2. If the server and application are in the same pc.
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=myservername;Initial Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="ForumConnectionString" connectionString="Data Source=myservername;Initial Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient" />
If any one knows how to use integrated security when the web application and the database are in different servers, please share your knowledge.
![]() |
0 |
![]() |