NT AUTHORITY\NETWORK SERVICE

G

Guest

My disk was replaced and i reload all my software. I think that i named my
computer best-si-01 instead of BEST-SI-01 and thats my error?

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
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
'NT AUTHORITY\NETWORK SERVICE'.

I have all my software on one system. .net and sql.

the system work fine before i had reload it.
 
G

Guest

I am assuming this is an asp.net app as you mention web requests. I would be
surprised if the machine name is incorrect. It is more likely the security on
your IIS virtual directory is not configured in the same way as it was
before. If you are using anonymous access, try changing the user account to
an account that will definately have DB access.
 
M

Michael Earls

Stanley said:
i am using server=localhost;Trusted_Connection=true;
What else do i have to do?
stan


:

Stan,

The solution to this problem depends on a few things.

Is your web application using Windows Security, or does it use Web Forms
or anonymous access? If you're trying to pass along the credentials
from the end user to the database (to limit database activity based on
known users), you'll need to make sure you've got impersonation enabled
in the Web.config (search MSDN and you'll find out how to do this).

If you're just using a single login to manage all database calls, then
you'll need to configure SQL Server to allow the NETWORK SERVICE user
access.

If the database and web server are on the same box, then just ensure
that the NT AUTHORITY\NETWORK SERVICE user has been granted permissions
on the database that you are accessing.

In SQL Enterprise manager, navigate to the database that you're trying
to access. Look under Security and add a new login. Choose Windows and
then select the "NT AUTHORITY\NETWORK SERVICE" user from the list (if
it's not there, you should be able to type it in).

Within the database, grant this user permissions to use the database (I
strongly suggest that you choose individual permissions rather than make
this user a "dbo" (database owner).

You have two other options. If the SQL Server and the Web server are on
separate machines (assuming they are in the same Windows domain), you
can change the user that IIS uses to execute your web application.
You'll do that from Internet Services manager. Tinker with the settings
and see if you can figure it out. If not, I'll tell you.

Once you change the user that IIS runs your application as, you'll need
to add this user to SQL server and grant the appropriate permissions.

There is another way...

If you have configured SQL server to allow "mixed mode" security, then
you can create a SQL login for your database and change the connection
string to use SQL security rather than Trusted. You then add your new
user credentials to the connection string ("uid=username;pwd=password;").

This is WAAY more information than you needed, but the answer is in
there somewhere. ;)

Michael Earls
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top