'Cannot establish connection to SQL Server
I am trying to access SQL DB that is located on my computer from an application that is located on a server (has IIS7).
I set the ConnectionString in the WebConfig with the IP of my computer and I always get this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I wanted to enable remote connections as it was mentioned in the error. These are the things that I tried in order to make it work:
- Made sure that "Allow remote connections" to this server is checked in the properties window of my server
- Enabled TCP/IP in the SQL Server Configuration Manager
- Right clicking on the TCP/IP and in "Properties" set the port to 1433 and removed the "0" in the Dynamic Ports
- Created a new rule in the Windows Firewall to allow the connection from port 1433
- Added sqlservr.exe from the MSSQL/Binn folder to "Allow a program through Windows Firewall"
- Restarted the service
None of it helped. What else can I do?
EDIT:
Connection string:
<connectionStrings>
<add name="someName" connectionString="Database=someDB;Server=<my computer's IP>;User=userName;Password=123" providerName="System.Data.SqlClient"/>
</connectionStrings>
Solution 1:[1]
I am showing SQL Express setting this should be same in standard and other versions. check this and follow the first link for connection specification and testing for this problem.
Check these links for checking error exists regarding this particular topic and fixing this:
Resolving “A network-related or instance-specific error"
SQLAuthority- could not open connection
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Niranjan Singh |