Windows Integrated Identity Authentication connects to the SQL Server database to create a safer connection

Source: Internet
Author: User

Abstract: today, I want to write a Windows Service Program in C #, which connects to an SQL Server 2003 database on Windows 2000 Server and uses SQL Server for authentication. Common programs can be connected, but Windows service programs cannot be connected.
Later, I checked the information and found a solution. Share it with you.
Three-step solution:
1. Create a user on the Server and configure the SQL Server database access permission.
2. Create an identical user on the client.
3. The service program logs on with the client user you just created.
Done!
 
Keywords: SSPI, Integrated Security, SQL Server and Windows, authentication, SQL Server does not exist, or access is denied.
 
Reference documents: Windows Authentication and SQL Server
Http://msdn.microsoft.com/library/chs/default.asp? Url =/library/CHS/f_and_m/html/vxconwindowsauthentication. asp
 
Visual Studio example: Fitch and Mather 7.0

Windows Authentication and SQL Server
Fitch and Mather 7.0 access SQL Server through SQL Server Authentication. Although it is very simple and provides easy-to-understand examples, it is not the safest method. Fitch and Mather 7.0 stores the connection string (including database creden。) in two locations: the Web. config file and the COM + Admin directory (in the constructor string of the FMStocks7.GAM. 7 component ). By default, any user can read these two locations, so it is easy to inadvertently disclose confidential information (creden ).
A better solution is to use Windows integrated security. First, the Windows identification that can be recognized by both the Internet Information Service (IIS) Server and the SQL Server database is required. There are two options:
· Domain account
If the server is part of the domain and the administrator can create the domain account of the application, this is the best method.
· Local Account with synchronization Password

Related Article

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.