Scenario 1: When addkeyConnectionStringvalueserver127.0.0.1, database name, and u are used in the webconfig file to connect to the database, the database cannot be logged on normally, A lot of errors have occurred. Scenario 2:
Use an IP address to connect to SQL SERVER or configure it as a connection string. Scenario 1: Use add key = "ConnectionString" value = "server = 127.0.0.1; database = database name in the webconfig file; uid = sa; pwd = 1 "/to connect to the database and find that the database cannot be logged on normally, resulting in a lot of errors. Scenario 2: or when
Failed to connect to SQL SERVER by using IP address or configuring as connection string
Scenario 1: when used in the webconfig File
To connect to the database, and found that the login failed, a lot of errors;
Scenario 2:
Alternatively, when you connect to SQL SERVER, enter the following IP Address:
The system prompts that a connection fails or a connection error occurs.
Solution:
Step 1: Check whether the TCP/IP protocol is Enabled:
In the "Start" menu, find "Configuration tools" in microsoft SQL server 2005, open SQL SERVER Configuration Manager, and click in. Select the SQLEXPRESS protocol ,, in "TCP/IP" on the right, double-click it and enable it if "disabled" is displayed:
Step 2: Select "MSSQLSERVER protocol" and enable "TCP/IP"
Step 3: select the subnode "Client protocol" in "SQL Native Client configuration" and check whether the "TCP/IP" Protocol on the right is enabled. If not, enable it:
Step 4: Double-click "TCP/IP protocol" to view the properties panel and check whether the listening port is port 1433.
Step 5: restart the computer ~~ Test logon ~~ Succeeded ~~~
Additional:
If "local" or "localhost" cannot be used
Solution:
Open the C: \ Windows \ System32 \ drivers \ etc path and find
Hosts file;
Open it in notepad to see if there are any examples:
# Localhost name resolution is handled within DNS itself.
#127.0.0.1 localhost
If not, add them below;
Then restart the computer ~~ OK ~~
========================================================== ========================================================== ===
Welcome to exchange and learn QQ: 392989505