IP connection to SQL server failed (configuration as string failed). Solution


Failed to connect to SQL server using IP or configured as connection string

Scenario 1: whenwebconfigUsed in documents

< add key = “connectionstring” value = “server =; database = database name; uid = Sa; PWD = 1” / > connect to the database. It is found that normal login cannot be performed during login, and a lot of errors occur;

Scenario 2:

Or when connecting to SQL server, enter the IP address as follows:


Prompt: unable to connect or wrong connection.



Step 1: check TCP / IPWhether the agreement has been started:

In the “start” menu, find the “configuration tool” in Microsoft SQL Server 2005, open the SQL Server Configuration Manager, click in, select the protocol of sqlexpress, and view it in the “TCP / IP” on the right. If “disabled” is displayed, double-click it to enable it:



Step 2: select “MSSQLSERVER Protocol” and enable “TCP / IP” as well


Step 3: select the “client protocol” of its child node 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 property panel to see whether it listens to “1433” port


Step 5: finally restart the computer ~ ~ test login ~ ~ successful~~~




If you find that “local” or “localhost” cannot be used, you cannot log in


Open C: \ windows \ system32 \ drivers \ etc and find

Hosts file;

Then use Notepad to open it and see if there is any such as:

Copy codeThe code is as follows:
# localhost name resolution is handled within DNS itself.
#       localhost

If not, add below;

Then restart the computer ~ ~ OK~~