new thread unable to connect sql server 2005 giving user is not associated with trusted sql server connection

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
acheema
6/7/2007 12:33:51 AM
asp.net.security 27051 articles. 1 followers. Follow

1 Replies
1334 Views

Similar Articles

[PageSpeed] 45
Get it on Google Play
Get it on Apple App Store

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
coolvaas1
7/4/2007 8:22:48 PM
Reply:

Web resources about - new thread unable to connect sql server 2005 giving user is not associated with trusted sql server connection - asp.net.security

Monday Morning Open Thread: Cat Koan
Warm, yet chill. From commentor James J : This is my daughter’s cat Peaches relaxing by a toasty fire escaping all of the holiday hoopla. If ...

'Making a Murderer': Filmmakers say media is 'demonizing' Steven Avery
People Magazine 'Making a Murderer': Filmmakers say media is 'demonizing' Steven Avery Daily Democrat The filmmakers behind "Making a Murderer," ...

'Spotlight' wins best picture at Critics' Choice Awards
USA TODAY 'Spotlight' wins best picture at Critics' Choice Awards USA TODAY LOS ANGELES — Spotlight edged forward in the Oscar race Sunday ...

Why the Carolina Panthers can beat the Arizona Cardinals in NFC title game
Three reasons why the Carolina Panthers can beat the Arizona Cardinals in next Sunday's NFC Championship Game.

Burkina Faso and Mali to coordinate forces after deadly attacks
By Matthew Mpoke Bigg and Nadoun Coulibaly OUAGADOUGOU (Reuters) - Burkina Faso and Mali have agreed to work together to counter the growing ...

Rey Mural for a Star Wars Fan
The Force is strong with this family. Emily Rose is an artist. Her seven-year-old daughter is an avid Star Wars fan, and has been all her life. ...

Details About 12 Marines Missing in Hawaii Helicopter Crash
The US Marine Corps has released the names of the 12 Marines missing after 2 helicopters crashed off Hawaii

Confederate flag's removal turns King Day into celebration
COLUMBIA, S.C. (AP) — Civic leaders, activists, artists and others are celebrating, marching and paying homage Monday to Martin Luther King Jr., ...

Microsoft: newer processors will only run Windows 10 or later
Microsoft has just revealed a new policy that once again tries to "encourage" users to upgrade to or embrace Windows 10, but this time it won't ...

Marco Rubio is so worried about ISIS he bought a gun to fight them off
On Sunday, U.S. Senator Marco Rubio (R-FL) managed to insert himself into the sweet spot between two of the hottest topics in the presidential ...

Resources last updated: 1/18/2016 10:27:36 AM