.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
If your connection to SQL Server is fast locally (~0.3s) but takes ~5 seconds from another machine in the same LAN, and you're using IP + port (e.g. 192.168.1.10,1433), the issue may not be SQL Server itself.
In my case, I was using:
- Microsoft SQL Server 2022
-
Microsoft.Data.SqlClient - SQL authentication (
sa) -
Encrypt=TrueandTrustServerCertificate=True
Telnet to port 1433 was instant, so network connectivity was fine. However, connection.Open() consistently took ~5 seconds.
After running Wireshark, I noticed this pattern before the TDS pre-login:
- TCP handshake (instant)
- Several NBNS (NetBIOS Name Service) broadcasts
- ICMP “Port Unreachable” responses
- Only then TDS pre-login started
The delay happened during those repeated NBNS attempts.
Root Cause
Windows was attempting NetBIOS name resolution before proceeding, even though I was connecting via IP address. Because no WINS server was present, it retried multiple times and waited for timeouts (~5 seconds total).
Fix
On the client machine, disable NetBIOS over TCP/IP:
- Open Network Connections
- Right-click your active adapter → Properties
- Select Internet Protocol Version 4 (TCP/IPv4) → Advanced
- Go to the WINS tab
- Select: Disable NetBIOS over TCP/IP
- Reboot (not required)
After disabling NetBIOS, the connection time dropped from ~5 seconds to <0.5 seconds.
Why This Happens
If:
- Machines are in a workgroup (no domain)
- No WINS server exists
- NetBIOS is enabled
Windows may try legacy name resolution and wait for timeouts before continuing. This delay appears at the application level as a slow Open() call.