question

chandru avatar image
chandru asked

Connection error

I have got this error when trying to connect with SQL Server 2000 from ASP.NET 2.0 using Windows Authentication. >Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The Sql server is in Mixed Mode and it is running on Windows Server 2000. Connection String used : "Data Source=server;Initial Catalog=db;Integrated Security=SSPI" any idea? Thanks in Advance Chadru
sql-server-2000connectionconnection-string
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

chandru avatar image chandru commented ·
Thanks Kev, Matt and Qleg. I just started using SQL for the time being. Meanwhile, I am trying to sort out the issues as directed by you all. Will get back to you with my solutions. Thanks again.
0 Likes 0 ·
Show more comments
Kev Riley avatar image
Kev Riley answered
You are trying to connect using windows authentication, but the account you are using is not allowed.
9 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
But what is the application running under when it tries to connect
1 Like 1 ·
chandru avatar image chandru commented ·
Kev, but i am able to connect using SSMS through windows authentication.
0 Likes 0 ·
chandru avatar image chandru commented ·
It works fine when we debug the web application ( ASP.NET). but it won't when we publish in IIS. We are using Integrated Windows Authentication in IIS.
0 Likes 0 ·
Kev Riley avatar image Kev Riley ♦♦ commented ·
I'm no IIS expert, but what account does IIS run under? It's that account that you need to check the permission on
0 Likes 0 ·
chandru avatar image chandru commented ·
Yes, when we say Integrated Windows Authentication in IIS, it will consider Windows domain account (domain\user). I have also created the domain user in SQL Server.
0 Likes 0 ·
Show more comments
Matt Whitfield avatar image
Matt Whitfield answered
You could add a Windows Authentication account to the SQL Server that maps to the service process used for IIS - but it might be better not to do that, as that would mean that the IIS process would have access to your SQL Server by default.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image Oleg commented ·
I believe that if you have **** in the web.config of the web app then it is totally bad because the account of the user connected to the site will be attempted to be used to connect to SQL Server, which is horrible as it will completely destroy connection pooling. if you have **** then the account used to run the IIS process will be attempted to be used (there are no App Pools in Windows Server 2000). In any case, in order for whatever credentials to be passed from the server hosting IIS to the SQL Server, one AD permission need to be set, I think it is called **Allow Kerberos to delegate requests**. If you ask any sane network admin to add it, the simple answer would be that ***it will never happen***. To make the long story short, it is not a good idea to attempt using SSPI to connect to SQL Server from the web app. Just my 2 cents.
2 Likes 2 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.