Question

I have a WinForms application installed on multiple PCs in an office, and a SQL Server 2012 Express database on the server to which the client application connects.

Each machine fails to connect on the first two attempts giving an error -

Timeout Expired: The timeout period elapsed prior to the completion of the operation or the server is not responding.

However, it always works on the 3rd attempt on all machines!

The server is SBS 2008, the machines are running Windows 7.

Était-ce utile?

La solution

The issue was I had used a Named Instanced on SQL Server which by default uses dynamic ports. Hence each connection attempt used a different Port, and each time I was asking the server administrator to allow additional ports. The successful log ins where simply because the dynamic port chosen just so happened to be one previously allowed.

The answer was to use SQL Server Configuration Manager to remove the dynamic port setting and specify a single port to use for all connection attempts, and ensure firewalls etc had an exception for that particular port.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top