Solved

Login failed for user 'null"

Posted on 2009-05-07
12
333 Views
Last Modified: 2013-12-17
Good afternoon expert,

Using
    <connectionStrings>
        <add name="TimeEntry_bConnectionString" connectionString="Data Source=labsdirvg600;Initial Catalog=TimeEntry_b;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
I get

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

So i found a service account called WTE at the SQL server with a login and made WTE a user on the database. Then I made WTE a user on the Web server and at Edit Anonymous user on the IIS property of the web site mad the user WTE.

THen changed the web.config to
    <appSettings/>
    <connectionStrings>
        <add name="TimeEntry_bConnectionString"
       
        connectionString="Server=labsdirvg600;Database=TimeEntry_b;User ID=WTE;Password=King0n1;Trusted_Connection=False;"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
I then get
Login falied for user WTE

What am I doing wrong?

Thanks

Allen In Dallas
0
Comment
Question by:9apit
  • 5
  • 4
  • 3
12 Comments
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24329071
check under properties of the SQL server (Right click), in "security" page (on left), make sure the server authentication is set to "SQL SERVER and Windows Authentication Mode"
0
 

Author Comment

by:9apit
ID: 24329178
Yes the server is set for mixed mode
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24329195
then try with SA (if you have the password)
if it work, you will know it<s a problem int the SQL server  user.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 18

Expert Comment

by:David Robitaille
ID: 24329245
you could also try this
connectionString="Data Source=labsdirvg600;Initial Catalog=TimeEntry_b;User ID=WTE;Password=King0n1;Persist Security Info=True"

0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24330242
You might need the full domain for the user
 
 WTE@domain.com
0
 

Author Comment

by:9apit
ID: 24330614
Tried it both ways with and with the domain name. Same result. Inserted    
 <identity impersonate="true" /> in web.config.
The web app worked on the local machine but not on any remote
computer. And when iinserted the name of the machine in the URL
in address instead of 'localhost' the error reappeared. Wierd.
THen after that the Login failed for user 'null" appears on the local
machine no matter how I call it.
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24330664
Can you Ping the Machine Name?
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24331372
and doid you allow TCP/ip for the SQL server?
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 24331383
0
 

Accepted Solution

by:
9apit earned 0 total points
ID: 24331424
Success.

There are two types of connection strings.
One uses a trusted connection. The other uses
a username and password. Used the latter
and set up an account with those credentials at the DB.

I think my mistake was thinking that the
the credentials at the web server had to be
the same as the credential at the SQL Server.
It is true that the log in the local Windows user has to be the
same as the Anonymous User at the IIS
Properties. This calls the web.config.
Then the credentials in the web.config have to
be the same as the credentials in the SQL server
security login. But the credentials at the web server
do not have to match authentication at the DB
server.
 
Allen
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24331784
Did any of our answers rule out possibilities and help you arrive at your answer quicker?
0
 

Author Comment

by:9apit
ID: 24331819
Good evening Mr. Campbell,

Perhaps the problem that I posed is so integrated to the
environment in which I was troubleshooting that it would
be almost impossible for someone not in that environment
to take an deductive approach to a solution.

To answer your question, no, only one of thel the answers
I got had to do with the connection string and it wasn't
even close.

Thanks.

Allen
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question