Critical severityconnection
SQL Server Error:
10061, SQL Server Not Running
What does this error mean?
Windows socket error 10061 (WSAECONNREFUSED) means the target host actively rejected the TCP connection — the port is closed, not filtered. In a data pipeline context this typically means the SQL Server service is not running or is bound to a different port than the connection string specifies. Unlike a timeout (10060), a connection refusal is immediate: the operating system on the target machine sends back a TCP RST packet. ADF activities fail within milliseconds, Power BI refreshes abort at the connection phase, and SSIS packages throw a pre-login error. The database never received the request.
Common causes
- 1SQL Server service is stopped. The Windows service MSSQLSERVER (default instance) or MSSQL$INSTANCENAME (named instance) is not running. This is the most common cause — the service may have crashed, been stopped manually, or failed to start after a server reboot.
- 2SQL Server is listening on a non-standard or dynamically assigned port. By default SQL Server uses TCP 1433, but named instances use a dynamic port assigned at startup. If the port changed (e.g. after a reinstall or config change) and the connection string still specifies the old port, every connection is refused.
- 3SQL Server Browser service is stopped. Named instances rely on the Browser service (UDP 1434) to resolve the instance name to the correct TCP port. If Browser is stopped, clients cannot discover the port and fall back to 1433, which may not be where the named instance listens.
- 4A firewall rule blocks the SQL Server port on the server side. Windows Firewall or a network-level firewall drops the incoming TCP packet, but unlike a silent drop the local Windows TCP stack returns a RST if the port has no listener — so the error manifests as 10061 rather than a timeout.
- 5The connection string points to the wrong host or instance name. A stale hostname in a linked service, a DNS change that hasn't propagated, or a copy-paste error in the server name causes the connection to reach the right machine but the wrong port — or a machine that has no SQL Server at all.
- 6SQL Server is bound only to a specific IP address (e.g. 127.0.0.1 or a secondary NIC) and the client is connecting via a different IP. This happens after network reconfiguration or when SQL Server Configuration Manager has specific IP bindings enabled and IPAll is disabled.
- 7The SQL Server instance was installed on a non-standard port (e.g. 1434 is reserved for Browser, so DBAs sometimes choose 1435 or 14330) and a connection string template from another environment with port 1433 was reused without updating the port.
How to fix it
- 1Step 1 — Confirm SQL Server is running on the target host. On the server: open services.msc and check that 'SQL Server (MSSQLSERVER)' or 'SQL Server (INSTANCENAME)' shows Status = Running. Remotely via PowerShell: Get-Service -ComputerName <server> -Name 'MSSQLSERVER' | Select-Object Status. If stopped, right-click → Start, or run as admin: net start MSSQLSERVER (default) / net start MSSQL$INSTANCENAME (named).
- 2Step 2 — Find the actual port SQL Server is listening on. Open SQL Server Configuration Manager → SQL Server Network Configuration → Protocols for <instance> → TCP/IP → double-click → IP Addresses tab → scroll to IPAll → read TCP Port (static) or TCP Dynamic Ports (if 0, a dynamic port was assigned). Alternatively query the error log: xp_readerrorlog 0, 1, N'Server is listening on'; the log line shows the actual port at startup.
- 3Step 3 — Verify the port is reachable from the client. From the pipeline host or gateway machine run: Test-NetConnection -ComputerName <server> -Port <port>. A TcpTestSucceeded = False with 'Connection refused' confirms the port is closed. If TcpTestSucceeded = True, the issue is at the driver or authentication layer, not the TCP connection.
- 4Step 4 — Check and fix the connection string port. In Azure Data Factory: open the linked service, expand Advanced, and confirm the port field matches what was found in Step 2. In Power BI Desktop: Data Source Settings → Edit → Server field — use the syntax <host>,<port> (comma, not colon). In SSIS: open the Connection Manager, edit the connection string property directly.
- 5Step 5 — If using a named instance, confirm SQL Server Browser is running. On the server: services.msc → SQL Server Browser → Status should be Running. Start it with: net start SQLBrowser. Then retry the connection using the instance name (e.g. SERVER\INSTANCENAME) without specifying a port and let Browser resolve it.
- 6Step 6 — Check firewall rules on the server. Run on the server: netsh advfirewall firewall show rule name=all | findstr -i '1433'. If no inbound rule exists for the SQL Server port, add one: New-NetFirewallRule -DisplayName 'SQL Server 1433' -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow. For named instances, also open UDP 1434 for Browser.
- 7Step 7 — Validate the fix end-to-end. From the pipeline host: sqlcmd -S <server>,<port> -U <user> -P <password> -Q 'SELECT @@VERSION'. A successful response confirms the port is open, the service is running, and credentials are accepted. Then trigger the ADF pipeline or Power BI refresh manually and confirm it completes without error 10061.
Example log output
System.Data.SqlClient.SqlException (0x80131904): 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: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) ---> System.ComponentModel.Win32Exception (0x80004005): No connection could be made because the target machine actively refused it
ActivityId: a3f1c2d4-..., Error Code: 10061Frequently asked questions
Source · learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors