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
1057 Views

Similar Articles

[PageSpeed] 12

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:

Similar Artilces:

2008 IIS7 connection to SQL Server 2000 on Web Server 2000: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I am setting up a windows 2008 IIS7 web server, and trying to connect to a windows 2000 sql server 2000 database. I have an IIS6 Windows 2000 web server activately connected just fine. I have anonymous and windows authentication enabled. And in my web.config I have identity impersonate="true" My sql server 2000 typically uses the IISUSER anonymous user set up in IIS6 on my original windows 2000 web server. But this new IIS7 is giving me grief. I can't seem to setup the IUSR or IISUSER or anything in it. I can't even use sql server credentials in my connection string altho...

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Hello All, I'm Getting the following error when calling a dll from my vb.net application. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The dll was written in vb6 and accesses a sql db using the following connection string. Public Const GLOBAL_DNS As String = "DSN=TransSrvFinal;UID=sa;PWD=admin;" This DLL works fine when called from other Windows Apps. However I'm now trying to call this dll from with in an asp.net application. I'm using vb.net as the codebehind. I'm a...

how can associated 'sa' with a trusted SQL Server connection in sql server 2005?
I want to use sa user login sql server 2005 to visit my database "dotnet20" but when I set the user property in User Mapping, It Report when I set it, An Error Occur like followCannot use the special principal 'sa'. (Microsoft SQL Server, Error: 15405)and also when I want to Login sql server use 'sa' user, It Report Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)how can  associated 'sa' with a trusted SQL Server connection? I'm having this exact same problem. When I login using Windows authent. I can co...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

Error while establishing a connection to the SQL server 2005
Hi, I had an old web application created during asp.net 1.1 and it have a connection problem with the sql server 2005 when it is mirgrated to a new webserver with dotnet framework 2.0 platform. I have enabled the remote access(TCP/IP and named pipes) in sql server 2005, did all the neccessary things, check whether the TCP/IP is enabled, named pipe is enabled...  I created another web application using VS 2005. The database connection works perfectly well.This are the connectionString from the old web application.<appSettings>    <add key="ConnectionString" value=...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all
When i enter log in, I get the following error page.    Server Error in '/' Application. An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the err...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allo
My site works fine in VWD2008 express, but I get this error when I try to use it on my live website. An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.  According to this article: http://support.microsoft.com/kb/914277  I am supposed to: 1. Click Start, point to Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Surface Area Configuration. Ok, th...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all #2
I get the following error and have been trying to figure out why I keep getting it.  Initially, I had placed my project under wwwroot folder and ran it under IIS and it gave this error.  Then I moved it to my local C drive and same thing.  I am sharing this project with two other co-workers and all our config files and code files are same...they don't get this error but I do.  I checked that SQL Server Client Network Utility has TCP/IP and the 'Named Pipes' enabled.  I thought maybe I have setting in the Visual Studio 2005 that I'm not aware of that&#...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all #3
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, Hi  I think you are trying to connect with remote server using windows authentication mode.Sql won't allow this ,so try to connect with server using sql authentication mode with(username and password)Happy ProgrammingShashi.  Check if this thread on the same discussion can help.http://forums.asp.net/p/1193329/2062685.aspx...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all #6
hi there! I've uploaded my website at online server. which has its database on its local server. Now whenever Im trying to open the website. I get the following message instead of website. "An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) " Im using sql server 2000 for database. Asp.net 2.0 Please hel...

Error : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does
Hi All, i am using tha conncetion string in web.config. <add name="MyLocalSqlConnection" connectionString="Data Source=.\SqlExpress;AttachDbFilename=|DataDirectory|\SqlServer\OC00003SQL.mdf;User Instance=false" providerName="System.Data.SqlClient"/>  Instance=false and true both i have used  but i am getting error like that. on my web hosting site  Error : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Serv...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all #4
Hi,I have SQL Server Express Edition. I tried working out some ASP.NET Labs in my local system. Here is the link of the Virtual Lab which I tried. http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032286906&EventCategory=3&culture=en-US&CountryCode=USI recieve this error in my local system. An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Cou...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not all #5
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)   <sessionState mode="SQLServer"sqlConnectionString="data source=LHX00CNU7401SQG\Session; integrated security=true"/>   I have done all the settings: --> enabling the protocols --> Starting teh SQlbrowser but still no luck. Pleas...

SQL Express
Hi,I have SQL Server Express Edition. I tried working out some ASP.NET Labs in my local system. Here is the link of the Virtual Lab which I tried. http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032286906&EventCategory=3&culture=en-US&CountryCode=USI recieve this error in my local system. An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Cou...

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