question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SqlConnection.Open hangs when connecting to SQL Server 2012SP4

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cheenamalhotracommented, Mar 3, 2020

@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.

0reactions
nayanishdamaniacommented, Mar 5, 2020

Please try to change Connection Timeout from 0 to 30, If you have given Connection Timeout is 0

Thanks

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found