This problem can occur if you have connection pooling turned off, and ephemeral ports are exhausted. Using connection pooling reduces the number of connections required to satisfy the same request throughput, and may resolve the problem.
Local port usage is commonly restricted to particular ranges, even for ephemeral ports, to make it easier to identify traffic and manage firewall rules for example.
Connection pooling is generally in place for database connections as connection is a relatively expensive operation. For this reason it is good to reuse connections.
As to why this is preventing you from connecting, you may want to look at this:
Perhaps MaxUserPorts has been modified to a non-default value? By default there should be 3976 ports available allowing 3976 simultaneous connections to the same remote IPaddress/port combination. (The port only has to be unique if the remote end is the same - the combination remoteIP:port plus localIP:port
must be unique).
Alternatively, some components manage their own local port allocation rather than delegating to the OS, so perhaps this is the case with SqlConnection
.