SqlConnection.Open hangs when connecting to SQL Server 2012SP4
See original GitHub issueThe following code hangs, when trying to connect to SQL Server 2012 SP4
var connection = new SqlConnection(connectionString);
connection.Open();
.NET Core Version: 3.1 (from mcr.microsoft.com/dotnet/core/sdk:3.1 docker image) System.Data.SqlClient Version: 4.3.0 OS: Linux (inside a container) SQL Server version: 2012 (SP4-GDR)
This code works on Mac and Windows though, connecting to exactly the same SQL Server.
According to Microsoft Extended Support doesn’t end until 2022, so I would expect that I could connect to it from .NET Core
Reproduction project: gist.github.com
SQL Server version details:
> SELECT @@VERSION AS 'SQL Server Version';
> Microsoft SQL Server 2012 (SP4-GDR) (KB4057116) - 11.0.7462.6 (X64)
Jan 5 2018 22:11:56
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
Related issue: dotnet/runtime#26759 - similar, but actually recommends upgrading to 2012
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
C# SQLConnection.Open() hangs, with no exception
SqlConnection.Open works. Connection strings work, although we don't know what your connection string is since you've removed every value.
Read more >Application hanging when testing SQL connection
I have implemented some checks to a settings form in my app to validate some of the data and test DNS resolution and...
Read more >My SQL server cannot start after a sudden shutdown
The error message says a system database, model has it's log file broken: SQL Server detected a logical consistency-based I/O error: ...
Read more >Disabled SSL on SQL Server, now connection fails
They have disabled SSL on both the server my service is running and the remote SQL Server. The SQL connection string is pretty...
Read more >SqlConnection hanging? – SQLServerCentral Forums
This is a feature of connection pooling. Whenever you create a SqlConnection, it checks the pool and if there is another connection w/...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@joozek78 Glad you’ve resolved it.
Please remember TLS 1.0 and TLS 1.1 are deprecated and not recommended protocols, so you must try to move to TLS 1.2 by upgrading server machines.
I will close the issue at our end.
Please try to change Connection Timeout from 0 to 30, If you have given Connection Timeout is 0
Thanks