I am trying to debug aspx.net and c# code. An sql connection to a remote SQL server default instance should be opened. The connection works fine if the windows firewall on the sql server host is down. If the windows firewall is up I get an error: named Pipes Provider Error 40 cannot open connection to Sql server instance
The dev machine is windows 10 with visual studio. The machine with the ms sql server instance is a vm with windows 2012 with sql server 2012. In that machine I get an error in the windows security events claiming that the user name or password is incorrect. This error is a bit strange since the user name and password must be correct (otherwise it would not work if the firewall was down)
I have already checked the sql server configuration manager TCP/IP and named pipes are enabled. In the firewall I already set an exception allowing a TCP connection to port 1433. In the sql server configuration manager - SQL Server network configuration - TCP/IP the listed port is 1433. So I cannot find my mistake in the firewall config. What am I missing?
Found the solution: The firewall rule to allow port 1433 had to be extended. Even though switching off the private firewall made the access work did not mean that the firewall rule allowing access only in the private profile would be enough. Making the port 1433 available for all profiles (private, public, domain) solved the problem.
Thanks to Christian. Even though port 445 is not needed in my case your comment was still helpful. I tried it and it did not work. So key was to find out which port is the blocking one.
This can be done with a simple netstat command. Performing netstat first when the connection is down and then netstat when the connection is up is a very simple way to find out which port must be openend.