473,388 Members | 1,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.

Wonder if someone can help!

We're getting the following error on our Intranet system as soon as we login..

------------------

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'NT AUTHORITY\LOCAL SERVICE'.

Source Error:
sql = "SELECT Projects.ProjectID, ProjectName, SessionID FROM Projects,
Sessions WHERE (Sessions.ProjectID = Projects.ProjectID) AND
(Sessions.SessionDate >= '" + theStart + "' AND Sessions.SessionDate <= '" +
theEnd + "') ORDER BY Projects.ProjectID DESC";

SqlConnection dbConn = new
SqlConnection(ConfigurationSettings.AppSettings.Ge t("System_ConnectionString"));

dbConn.Open();
SqlCommand prjCmd= new SqlCommand(sql, dbConn);
SqlDataReader prjDr = prjCmd.ExecuteReader();

-----------------

the error occurs at the "dbConn.Open();" line.

I've got no idea why this is suddenly happening. This has been working fine,
and then has suddenly stopped. As far as I'm aware, nothing has changed on
the server.

Details...

..net 2.0
Win2k3 Server
MSDE

the Intranet is running in its own pool in IIS.

It looks like a security issue, but what?!

Any help greatly appreciated!

Cheers
Dan


Jun 9 '06 #1
10 9614
Well, the error is exactly what it says. NT AUTHORITY\LOCAL SERVICE doesn't
have a login to the SQL Server / database. Either give it one, or have the
app use a different connection string with credentials that do have access.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"musosdev" wrote:
Wonder if someone can help!

We're getting the following error on our Intranet system as soon as we login..

------------------

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'NT AUTHORITY\LOCAL SERVICE'.

Source Error:
sql = "SELECT Projects.ProjectID, ProjectName, SessionID FROM Projects,
Sessions WHERE (Sessions.ProjectID = Projects.ProjectID) AND
(Sessions.SessionDate >= '" + theStart + "' AND Sessions.SessionDate <= '" +
theEnd + "') ORDER BY Projects.ProjectID DESC";

SqlConnection dbConn = new
SqlConnection(ConfigurationSettings.AppSettings.Ge t("System_ConnectionString"));

dbConn.Open();
SqlCommand prjCmd= new SqlCommand(sql, dbConn);
SqlDataReader prjDr = prjCmd.ExecuteReader();

-----------------

the error occurs at the "dbConn.Open();" line.

I've got no idea why this is suddenly happening. This has been working fine,
and then has suddenly stopped. As far as I'm aware, nothing has changed on
the server.

Details...

.net 2.0
Win2k3 Server
MSDE

the Intranet is running in its own pool in IIS.

It looks like a security issue, but what?!

Any help greatly appreciated!

Cheers
Dan

Jun 9 '06 #2
Hi Peter

Yeah that makes sense, but WHAT is this LOCAL SERVICE!? I've never heard of
it before? I thought everything was done from \NETWORK SERVICE?! Is that a
wrong assumption?!

Cheers
Dan

"Peter Bromberg [C# MVP]" wrote:
Well, the error is exactly what it says. NT AUTHORITY\LOCAL SERVICE doesn't
have a login to the SQL Server / database. Either give it one, or have the
app use a different connection string with credentials that do have access.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"musosdev" wrote:
Wonder if someone can help!

We're getting the following error on our Intranet system as soon as we login..

------------------

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'NT AUTHORITY\LOCAL SERVICE'.

Source Error:
sql = "SELECT Projects.ProjectID, ProjectName, SessionID FROM Projects,
Sessions WHERE (Sessions.ProjectID = Projects.ProjectID) AND
(Sessions.SessionDate >= '" + theStart + "' AND Sessions.SessionDate <= '" +
theEnd + "') ORDER BY Projects.ProjectID DESC";

SqlConnection dbConn = new
SqlConnection(ConfigurationSettings.AppSettings.Ge t("System_ConnectionString"));

dbConn.Open();
SqlCommand prjCmd= new SqlCommand(sql, dbConn);
SqlDataReader prjDr = prjCmd.ExecuteReader();

-----------------

the error occurs at the "dbConn.Open();" line.

I've got no idea why this is suddenly happening. This has been working fine,
and then has suddenly stopped. As far as I'm aware, nothing has changed on
the server.

Details...

.net 2.0
Win2k3 Server
MSDE

the Intranet is running in its own pool in IIS.

It looks like a security issue, but what?!

Any help greatly appreciated!

Cheers
Dan

Jun 9 '06 #3
OK,
Let's go to the source and read up on it!

http://msdn2.microsoft.com/en-us/library/ms143504.aspx

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"musosdev" wrote:
Hi Peter

Yeah that makes sense, but WHAT is this LOCAL SERVICE!? I've never heard of
it before? I thought everything was done from \NETWORK SERVICE?! Is that a
wrong assumption?!

Cheers
Dan

"Peter Bromberg [C# MVP]" wrote:
Well, the error is exactly what it says. NT AUTHORITY\LOCAL SERVICE doesn't
have a login to the SQL Server / database. Either give it one, or have the
app use a different connection string with credentials that do have access.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"musosdev" wrote:
Wonder if someone can help!

We're getting the following error on our Intranet system as soon as we login..

------------------

Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'NT AUTHORITY\LOCAL SERVICE'.

Source Error:
sql = "SELECT Projects.ProjectID, ProjectName, SessionID FROM Projects,
Sessions WHERE (Sessions.ProjectID = Projects.ProjectID) AND
(Sessions.SessionDate >= '" + theStart + "' AND Sessions.SessionDate <= '" +
theEnd + "') ORDER BY Projects.ProjectID DESC";

SqlConnection dbConn = new
SqlConnection(ConfigurationSettings.AppSettings.Ge t("System_ConnectionString"));

dbConn.Open();
SqlCommand prjCmd= new SqlCommand(sql, dbConn);
SqlDataReader prjDr = prjCmd.ExecuteReader();

-----------------

the error occurs at the "dbConn.Open();" line.

I've got no idea why this is suddenly happening. This has been working fine,
and then has suddenly stopped. As far as I'm aware, nothing has changed on
the server.

Details...

.net 2.0
Win2k3 Server
MSDE

the Intranet is running in its own pool in IIS.

It looks like a security issue, but what?!

Any help greatly appreciated!

Cheers
Dan

Jun 9 '06 #4
Hi Dan,

The error message did indicate that the login user doesn't have sufficient
permission access the target database, and since you mentioned the error
occur at the connection opening time, it is likely the calling
application's security identity doesn't have sufficient permission.
Currently I'd like to confirm the following information:

1. Are you running the ASP.NET application on a windows 2003 server with
IIS 6(also the ASP.NET application is hosted in IIS rather than .net test
server)?

2. Are you connecting to a SQL Server database in server engine or a SQL
Express data file?

3. If convenient, would you also paste the connectionstring to us(whether
use sql authentication or integrated windows)..

If you're using IIS6, then the ASP.NET security context should be the
application pool's identity (if you're not using impersonate in ASP.NET),
and by default the application pool identity is "NT AUTHORITY\NETWORK
SERVICE", however ,it is possible that someone changed it to other ones
such as LOCAL SYSTEM or LOCAL Service(these three accounts is common ones
used by service application).

Also, if you're using SQL Express database, by default the ASP.NET will
generate connectionstring which use "user instance" connnection mode that
help restricted account to access SQL Express data file. Sometimes changes
on this setting may cause login failed error:

#User Instances for Non-Administrators
http://msdn2.microsoft.com/en-us/library/ms143684.aspx

Anyway, please have a look at the above ones and if there is anything
unclear in them or any other questions, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 12 '06 #5
Hi Dan,

How are you doing on this issue, does my last reply helps you a little? If
there is anything else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Steven Cheng

Microsoft MSDN Online Support Lead

Jun 14 '06 #6
Hi Steven

Apologies for not replying - I went away and forgot about this problem!

I need to find out from the client if it's still happening, and if it is
I'll go through your post and address the issues you've brought up!

Thanks - and sorry again for disappearing!

Cheers

Dan
"Steven Cheng[MSFT]" wrote:
Hi Dan,

How are you doing on this issue, does my last reply helps you a little? If
there is anything else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Steven Cheng

Microsoft MSDN Online Support Lead

Jul 3 '06 #7
Thanks for your followup Dan,

Nevermind. Just keep your focus on your first priority items and if there
is anything else need help later, please feel free to post here.

Regards,

Steven Cheng

Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 3 '06 #8
Steven,

Ok, it's still broken, so to reply to your original questions...

Hi Dan,

The error message did indicate that the login user doesn't have sufficient
permission access the target database, and since you mentioned the error
occur at the connection opening time, it is likely the calling
application's security identity doesn't have sufficient permission.
Currently I'd like to confirm the following information:
1. Are you running the ASP.NET application on a windows 2003 server with
IIS 6(also the ASP.NET application is hosted in IIS rather than .net test
server)?
IIS 6 running on Win2k3 Standard. The app is running in it's own AppPool and
its built on .NET v2.0.50727.
2. Are you connecting to a SQL Server database in server engine or a SQL
Express data file?
MSDE, so thats SQL Server Engine I think? :)
3. If convenient, would you also paste the connectionstring to us(whether
use sql authentication or integrated windows)..
Don't have it to hand, but I could get it if necessary... I can tell you
that we use Windows Authentication for the app, and I think the sql conex
string is using a Trusted Connection.

Okay, you then said...
If you're using IIS6, then the ASP.NET security context should be the
application pool's identity (if you're not using impersonate in ASP.NET),
and by default the application pool identity is "NT AUTHORITY\NETWORK
SERVICE", however ,it is possible that someone changed it to other ones
such as LOCAL SYSTEM or LOCAL Service(these three accounts is common ones
used by service application).
This is a possibility cos I'm not the server Admin, so something could have
been changed by someone else. How do I check/change the Security context?

Thanks for your time!

"Steven Cheng[MSFT]" wrote:
Thanks for your followup Dan,

Nevermind. Just keep your focus on your first priority items and if there
is anything else need help later, please feel free to post here.

Regards,

Steven Cheng

Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 4 '06 #9
Thanks for your followup Dan,

I'm sorry to hear that the problem still remain. I still think the issue is
due to the security context of the application that used to access the MSDE
db. For your further questions:

MSDE, so thats SQL Server Engine I think? :)
===================================
Yes, MSDE is a desktop database engine in contrast to SQL Server 2000
server engine. Currently SQL 2005 has shipped a new free desktop engine
named "SQLExpress". (This is much more powerful and I would suggest you
have a look at your convenience:) )

Don't have it to hand, but I could get it if necessary... I can tell you
that we use Windows Authentication for the app, and I think the sql conex
string is using a Trusted Connection.
=========================
Since you can confirm that the connection is using trusted
connection(windows authentication), the decent string is not necessary.

This is a possibility cos I'm not the server Admin, so something could have
been changed by someone else. How do I check/change the Security context?
======================================

You can use the following code snippet to display the current security
identity of ASP.NET worker thread(be executing):

Response.Write("<BR/>Security Identity: " +
System.Security.Principal.WindowsIdentity.GetCurre nt().Name);

BTW, since you're caring about the identity used to access the SQL server
(MSDE), you can put the above code right before the connection opening code.

Hope this helps. Please feel free to post here if there is anything unclear
or any other problem on this.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 4 '06 #10
Hi Dan,

How are you doing or any progress on this issue? Please feel free to post
here if you got any progress or still need any assistance on this.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 7 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pmud | last post by:
Hi , I created a very simple ASP.NET application & am getting the following error: Login failed for user 'NT AUTHORITY\NETWORK SERVICE' Exception Details: System.Data.SqlClient.SqlException:...
1
by: Ibrahim Mohamed El-Ganady | last post by:
Mr : I have proplem with Visual stdio 2003 and Windows2003 Enterprise Server , when I developed web application using ASP.Net (VB) that establish connection to SQL Server database the following...
3
by: Evan Camilleri | last post by:
I have a problem for a Windows Service to login on an SQL server (different machine) - neither Windows Authentication nor SQL Authentication worked. LOGIN FAILED FOR USER sa (for example). If...
1
by: TOLI | last post by:
Where do a set the right user rights for ASP.NET 2 to connect to a SQL service Se below // Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK...
1
by: kalaivanan | last post by:
hi, i have developed a web application. i need to connect to sqlserver 2000 to fetch data and i am getting the following error when requested for login page. Login failed for user 'NT...
10
by: BLUE | last post by:
I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this setting: <add name="SqlServerTrustedConn" providerName="System.Data.SqlClient" connectionString="Data...
0
by: BHollister | last post by:
Hi All, I have written a web service that works fine in development and fails when deployed to my localhost. The development solution is configured as: Business Object Project Service...
1
by: NannMaw | last post by:
Hi,good evening all. I am a beginner in web development and SQL server. I got the below error when running the web application on development server of MS visual studio 2005. I guess that...
4
by: Brett | last post by:
I have an ASP.NET 2.0 application that uses Forms Authentication. The startup page contains just a login control, and the site works well on an IIS 6 web server. I am now setting the site up on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.