When trying to connect to a database using NUnit in VisualStudio17 or Jetbrains Rider, I am consistently getting a 30+ second delay in the connection before it runs. However, when I open a connection in LINQPad or run a command line app that establishes a connection, it is instantaneous. I have also tried invoking an NUnit test which establishes a connection from LINQPad, and the result is also instantaneous. Other members of my team with the same environment do not have this issue.
Our theory is that VisualStudio and Rider are running into some timeout issue (possibly due to IntegratedSecurity) before successfully connecting, but we can't figure out why this would be any different from the connections created using other means. Any ideas for what to try next or what could be going on here?
using System.Data.SqlClient;
using NUnit.Framework;
namespace ConnectionTest
{
public class ConnectionTestClass
{
[Test]
public void TestMethod()
{
var connectionStringBuilder = new SqlConnectionStringBuilder
{
DataSource = "server_name",
InitialCatalog = "database_name",
IntegratedSecurity = true
};
var connection = new SqlConnection(connectionStringBuilder.ConnectionString);
connection.Open();
connection.Close();
}
}
}