Solved

Login failed for user 'null"

Posted on 2009-05-07
12
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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