Solution to nt authority/network service logon Failure

Source: Internet
Author: User
Tags asp net

An error occurred while logging on to the nt authority/network service. My system is win2003 and the database is sql2005. The solution is to change the database owner to nt authority/network service.

Solution for others on the Internet:

User 'nt authority/network service' Logon Failed.

This error occurs when you connect to SQL Server using a trusted connection. in Windows XP, Asp. the Running Account of net is ASPnet, while in Windows Server 2003, the running account is changed to network service, and the user is directly added to the login account of SQL Server, in this way, many examples do not need to change the connection string!

# Re: User 'nt authority/network service' Logon Failed.

Step 1: Add 'nt authority/network Service' to the Administrator Group
My computer --> right-click --> Manage --> local users and groups
Select "group" --> double-click "Administrators" --> click "add" --> click "advanced" --> click "find now" --> select a network service user from the list below --> click "OK" --> join twice.

Step 2 Add a netword service user to the Enterprise Manager
Open SQL Server Enterprise Manager --> select database instance --> open "security" node --> select "login" --> right-click the list on the right --> select "New login "--> on the "General" tab, click the button next to "name"... "--> select" Administrators "group --> click the" members "button below --> select" Network Service "--> click" add "--> click" OK ", return to the "New login" dialog box --> ensure that the authentication type is "Windows Authentication" and "Allow access" --> click "OK" --> close "Enterprise Manager"

Step 3
Run the Asp.net program again and select windows for the database connection string.

========================================================== ============================================

Recently in. net using ADO. net test a small program, the operation object is the northwind SQL Server Sample Database, the results found that always prompt database connection failure, the error of "authority/network services login failed. On msdn, I found the original problem of SQL Server Authentication. I have never considered this problem before. The solution on msdn is as follows: when ASP. when the net application is running, it runs in the context of a special local user named ASPnet (in Windows 2000 and Windows XP) or network service (in Windows Server 2003) by default. This user account has enough permissions to run applications on a Web server computer. If SQL Server and web server are on the same computer, you can define asp net or network service users as users on SQL Server. The advantage of this method is that it is secure because Web applications run in a limited security context. It is also efficient to use a single user name with SQL Server, because this allows SQL Server to use the connection pool to enhance application scalability. Grant SQL Server permissions to ASPnet or network service users
  1. From the "Start" menu of windows, select "Microsoft SQL Server" and select "Enterprise Manager ".
  2. Open the node of the server and expand the node of the database to which you want to grant permissions.
  3. Right-click the "user" node and select "Database User ".
  4. In the "Database User Properties" dialog box, enter "computer name/ASPnet" in the "Login Name" box, and then click "OK ".
 

For Windows Server 2003 that I use, the user who adds nt authority/network services to the database can find the user in the user group in "users and groups. OK!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.