-
Notifications
You must be signed in to change notification settings - Fork 312
Open
Labels
Triage Needed 🆕For new issues, not triaged yet.For new issues, not triaged yet.
Description
Describe the bug
When connecting to a remote server, version 6.1.0 is taking significantly longer than 6.0.2
using Microsoft.Data.SqlClient;
namespace SqlServerConnectTest
{
internal class Program
{
static void Main(string[] args)
{
var builder = new SqlConnectionStringBuilder();
builder.DataSource = "xxx";
builder.InitialCatalog = "xxx";
builder.UserID = "xxx";
builder. Password = "xxx";
builder.TrustServerCertificate = true;
builder.ApplicationName = "Connection test";
builder.ConnectTimeout = 30;
builder.Encrypt = true;
Console.WriteLine(builder.ConnectionString);
using (var cn = new SqlConnection(builder.ConnectionString))
{
try
{
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
cn.Open();
stopwatch.Stop();
Console.WriteLine("Connection successful!");
Console.WriteLine($"Time taken to connect: {stopwatch.ElapsedMilliseconds} ms");
}
catch (SqlException ex)
{
Console.WriteLine($"SQL Error: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"General Error: {ex.Message}");
}
}
}
}
}
When running 6.0.2 on my system this took 948ms, in 6.1.0ms this takes 16494 ms. This is running in .NET 9 and the SQL Server is 2019.
Expected behavior
The connection should happen in roughly the same time on both versions
Metadata
Metadata
Assignees
Labels
Triage Needed 🆕For new issues, not triaged yet.For new issues, not triaged yet.