Skip to content

EF Core SqlServer connect hang #562

@oguzhantopcu

Description

@oguzhantopcu

Describe the bug

Can not able to connect SQL Server instance. No exceptions, it just hangs at 'OpenConnection' function indefinitely. Even though I give 10 seconds of timeout, it does not timeout.

No exceptions. Just logs. Trace enabled.

May 13 09:08:46 ubuntu pompa-proxy[4071]: dbug: Microsoft.EntityFrameworkCore.Infrastructure[10401]
May 13 09:08:46 ubuntu pompa-proxy[4071]:       An 'IServiceProvider' was created for internal use by Entity Framework.
May 13 09:08:52 ubuntu pompa-proxy[4071]: info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
May 13 09:08:52 ubuntu pompa-proxy[4071]:       Entity Framework Core 3.1.4 initialized 'OrkaContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: CommandTimeout=10
May 13 09:08:52 ubuntu pompa-proxy[4071]: dbug: Microsoft.EntityFrameworkCore.Database.Connection[20000]
May 13 09:08:52 ubuntu pompa-proxy[4071]:       Opening connection to database 'ORKA_0996_2020' on server '192.168.0.250\ORKASQL'.

To reproduce

                var context = _serviceLocator.GetInstance<OrkaContext>();
                
                context.Database.OpenConnection();

                _logger.LogInformation("Execution is starting...");

                context.Database.ExecuteSqlRaw(@"...

Expected behavior

A connection should be opened or an exception should be thrown.

Further technical details

Microsoft.Data.SqlClient version: 3.1.4
.NET target: .NET Core 3.1.4
SQL Server version: SQL Server 2012 SP4
Operating system: Ubuntu 20.04 (Client) , Windows Server 2012 (Server)

Additional context
It was working until I have upgraded my ubuntu. At first, I got an SSL exception. I have upgraded the SQL server to SP4 to resolve issue, it did solve problem. but hang problem started.

I can connect to the database from the server's itself by sql server management studio using sql server authentication.
There are windows computers in the office, I can confirm they can connect to the sql server, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions