It is network related.
Error is :
The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. This failure occurred while attempting to connect to the routing destination. The duration spent while attempting to connect to the original server was..
Solution 1 : It turned out that TCP/IP was enabled for the IPv4 address, but not for the IPv6 address of the SERVER.
Apparently some connection attempts ended up using IPv4 and others used IPv6.
Enabling TCP/IP for both IP versions resolved the issue.
Solution 2 : The default value of connection is 15 seconds. Add connection timeout to connection string;
connectionString="Data Source=.;Initial Catalog=myDB;User ID=testUser;Password=123456;Connection Timeout=30"
Solution 3 : Set connection string TransparentNetworkIPResolution = False (for .NET Framework 4.6.1) When we set it to false in the connection string it will not timeout at 500ms and the connection succeed. https://learn.microsoft.com/tr-tr/archive/blogs/dataaccesstechnologies/connection-timeout-issue-with-net-framework-4-6-1-transparentnetworkipresolution
connectionString="Data Source=.;Initial Catalog=myDB;User ID=testUser;Password=123456;Connection Timeout=30;TransparentNetworkIPResolution=False"