Fix it now
These two look similar in a client dialog and mean opposite things. 10061 is WSAECONNREFUSED: the target machine actively refused the connection, so the path is fine and the fault is on the server. 10060 is WSAETIMEDOUT: nothing responded, which is what a firewall configured to drop rather than reject looks like.
Test-NetConnection sqlhost -Port 1433
netstat -ano | findstr :1433
- Time the failure. A near-instant failure is a refusal, so look at the server. A failure that takes fifteen or thirty seconds is silence, so look at the path.
- Find the port the instance is really listening on:
SELECT local_tcp_port FROM sys.dm_exec_connections WHERE session_id = @@SPID;on the server, or the IP Addresses tab of TCP/IP properties in SQL Server Configuration Manager. - For a refusal, confirm the service is running and TCP/IP is enabled for the instance, then restart the SQL Server service if you enabled a protocol.
- For a timeout, open the port inbound on the Windows firewall and on any network device between the two subnets, then retest.
The 258 you may see alongside a 10060 is the Windows system error WAIT_TIMEOUT, the wait operation timed out. It is not SQL Server engine error 258, which is an unrelated message about calling methods and belongs to a different investigation entirely.
If the port test succeeds from the client that failed, you are done. If not, the next section separates the five things that produce these two codes.
Why it happens
When a client opens a TCP connection it sends a SYN, and three things can happen. The server answers with a SYN-ACK and you have a connection. It answers with a reset, meaning the host is up and nothing is listening on that port, and that is 10061, published as connection refused because the target computer actively refused it, which usually results from trying to reach a service that is not running there. Or nothing comes back at all, the client retries and eventually gives up, and that is 10060, published as a connection attempt failing because the connected party did not properly respond after a period of time.
That distinction is the most useful diagnostic here, because it partitions the problem cleanly. A refusal means the network path is fine end to end and the fault is on the server: the service is stopped, TCP/IP is disabled, or it is listening on a different port from the one you asked for. Silence means the packet never reached a listener, so the fault is in the path: a host firewall set to drop, a network ACL, a security group, or a missing route.
The neighbouring codes fill in the corners, and each is narrower than it is usually described. 10065 is WSAEHOSTUNREACH, no route to host, which is a routing answer rather than a filtering one. 11004 is WSANO_DATA, a valid name with no data record of the requested type, the documented example being a host that returns an MX record but no A record. 10053 is WSAECONNABORTED, software caused connection abort, an established connection aborted by software on your own host, which is a different event from a connection that never opened.
258 deserves its own sentence because the number is reused. The 258 that turns up beside a 10060 is the Windows system error WAIT_TIMEOUT, the wait operation timed out. SQL Server also publishes an engine error 258, severity 15, about not being able to call methods on something, and the two have nothing to do with each other. Reading a network timeout as the engine error sends people to a T-SQL problem that does not exist.
Nothing is listening on the port you asked for
You have this one if An immediate refusal, and Test-NetConnection to that port returns False while other ports on the same host are fine.
- Confirm the service is running:
Get-Service -Name 'MSSQL*'on the server, or the Services console. - Confirm what is listening:
netstat -ano | findstr :1433, then match the process id in Task Manager’s Details tab. - Enable TCP/IP in SQL Server Configuration Manager if it is disabled, and restart the SQL Server service afterwards.
- Retest from the client.
The instance is on a different port from the one in the connection string
You have this one if A named instance, or an instance hardened at some point, and the failure started after a restart.
- Read the port from the IP Addresses tab of TCP/IP properties. A blank TCP Port with a value in TCP Dynamic Ports means the instance picks a port at every start.
- Either put the correct port in the connection string, or set a static port under IPAll and clear the dynamic ports value.
- Restart the SQL Server service so the change takes effect, then retest.
A named instance on a dynamic port behind a firewall is a recurring outage waiting to happen: the port changes on restart and the firewall rule does not.
A firewall is dropping the traffic silently
You have this one if A long timeout rather than a refusal, and the same test from a machine on the server’s own subnet succeeds.
- Add an inbound rule on the server for the instance’s TCP port, and UDP 1434 if you rely on the Browser.
- Check the path: ACLs between VLANs, cloud network security groups, and any inspection device in between.
- On a cloud virtual machine, check both the guest firewall and the platform’s network rules; either alone produces this.
- Retest with
Test-NetConnection, which reports the port state rather than just reachability.
The connection is reaching the wrong machine
You have this one if The port test succeeds but SQL Server is not there, or you get a refusal from an address you did not expect.
- Resolve the name and compare:
nslookup sqlhostagainst the server’s own IP configuration. - Look for stale DNS records, hosts file entries, and client-side aliases in SQL Server Configuration Manager.
- Where a load balancer or listener is in the path, confirm its health probe is passing and that it forwards to a live node.
11004 belongs here. A name that resolves but returns no address of the type requested is a DNS record problem, not a firewall one.
The listener is bound to specific addresses only
You have this one if Connections succeed from some networks and are refused from others, on a multi-homed server.
- Open the IP Addresses tab in TCP/IP properties and review each configured address, not just IPAll.
- Set Enabled to Yes for the addresses clients actually use, or set Listen All to Yes if that suits the design.
- Restart the service and retest from each network.
Full reference
Reading the failure
| Behaviour | What it tells you |
|---|---|
| Fails immediately | Refused; something answered. Look at the server, not the firewall |
| Fails after a long pause | Dropped; nothing answered. Look at the path |
| Works on the server console only | TCP/IP disabled, or the console is using shared memory |
| Works to the IP but not the name | Name resolution, not connectivity |
| Works for a default instance, fails for a named one | A different port, discovered through the Browser |
| Worked yesterday, fails today after a reboot | A named instance took a different dynamic port |
The codes, exactly as published
| Code | Symbolic name | Published meaning |
|---|---|---|
| 10061 | WSAECONNREFUSED | Connection refused. No connection could be made because the target computer actively refused it, usually a service that is not running on that host |
| 10060 | WSAETIMEDOUT | Connection timed out. The connected party did not properly respond after a period of time |
| 10065 | WSAEHOSTUNREACH | No route to host. A socket operation was attempted to an unreachable host |
| 11004 | WSANO_DATA | Valid name, no data record of requested type. The documented example is a name with an MX record and no A record |
| 10053 | WSAECONNABORTED | Software caused connection abort. An established connection was aborted by software in your host computer |
| 258 | WAIT_TIMEOUT | The wait operation timed out. A Windows system error, not the SQL Server engine error of the same number |
10053 is the odd one out here because it describes a connection that was already established and then ended, rather than one that never opened. If you are seeing it during a long-running query rather than at connection time, this is the wrong article and a query-lifetime investigation is the right one.
Quick reference
| Command | What it tells you |
|---|---|
Test-NetConnection host -Port 1433 |
Whether the port is open from this client, with no SQL client installed |
netstat -ano | findstr :1433 |
What is listening on the server, and which process id owns it |
Get-Service -Name 'MSSQL*' |
Whether the instance’s service is actually running |
SELECT local_tcp_port, client_net_address FROM sys.dm_exec_connections WHERE session_id = @@SPID; |
The port your own connection used, and the address you appeared to come from |
Cloud and virtualised paths
- There are usually two firewalls, the guest one and the platform’s network rules, and either alone produces a 10060.
- A load balancer with a failing health probe produces refusals from some clients and not others, on the same name.
- Private endpoints and service endpoints change which address a name resolves to, so check resolution from the client rather than from a jump box.
- Where an inspection appliance sits in the path, a connection that opens and then dies belongs with 10053 rather than with these two.
Making the fix hold
A firewall rule written against a dynamic port is correct until the next restart. Set a static TCP port under IPAll, clear the dynamic ports value, restart the service, and write the firewall rule against that number. Then confirm the port is unchanged after a second restart, which is the check that proves the change took rather than appeared to. Everything else in this article is diagnosis; that is the part that stops it recurring.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
10061 |
WSAECONNREFUSED: the target computer actively refused the connection, usually because nothing is listening on that port | Microsoft Learn |
10060 |
WSAETIMEDOUT: the connection attempt timed out because the connected party did not properly respond, typical of a firewall dropping the packet | Microsoft Learn |
258 |
WAIT_TIMEOUT, the wait operation timed out. The Windows system error the client reports beside a 10060, not the unrelated SQL Server engine error 258 | Microsoft Learn |
10065 |
WSAEHOSTUNREACH: no route to host. A routing problem rather than a filtering one | Microsoft Learn |
11004 |
WSANO_DATA: the name is valid but has no data record of the requested type, such as an MX record with no A record | Microsoft Learn |
10053 |
WSAECONNABORTED: software caused connection abort. An established connection aborted by software on your own host | Microsoft Learn |
Confirm the fix worked
Test-NetConnection <server> -Port <port>from the client that failed returns TcpTestSucceeded True.- A SQL client connects and
SELECT local_tcp_port, client_net_address FROM sys.dm_exec_connections WHERE session_id = @@SPID;confirms both ends. - Restart the SQL Server service and confirm the port is unchanged, proving it is static rather than dynamic.
- Test from a second client on a different subnet, so you know the firewall rule covers the range you meant.
- The application reconnects and runs its real workload, not just a port test.
Questions people ask about this
Why does it fail instantly sometimes and hang other times?
Because those are two different failures. An instant failure is a reset from the host, meaning nothing is listening. A hang is silence, meaning something is dropping the packet. Note the timing before you change anything, because it decides which half of the path you look at.
Is the 258 I am seeing a SQL Server error?
Not the one people assume. Beside a 10060 it is the Windows system error WAIT_TIMEOUT, the wait operation timed out. SQL Server does publish an engine error 258 about calling methods, but it is unrelated and searching for it sends you somewhere unhelpful.
Should I just open port 1433 to everything?
No. Open it from the subnets or hosts that need it. A database port reachable from the whole network is a standing invitation, and a scoped rule is no harder to write.
Is there anything to buy here?
No. Networking behaves the same in every SQL Server edition and this costs nothing to fix. Everything you need is in SQL Server Configuration Manager, the Windows firewall and your network equipment.
The port changes every time the server restarts. Why?
Named instances default to a dynamic port chosen at startup. Set a static port under IPAll in TCP/IP properties, clear the dynamic ports value, restart the service, and update your firewall rule to match.
