Is there a limitation on the number of (sequential) opened connection for SQL
Server User Instances? The following method will run to about the 240th
iteration then will receive a timeout exception (SqlException. "Timeout
expired. The timeout period elapsed prior to completion of the operation or
the server is not responding."). If User Instance=false then the method will
execute to completion. Note that connection pooling is off just for
demonstation; the real application does use connection pooling, but periodic
events require the connection pool to be cleared (and new connections
opened). This is a desktop application and a user instance is required.
static void Main(string[] args)
{
string connectionString = "Server=.\\SQLExpress; User Instance=true;
Trusted_Connection=Yes; Pooling=false; Connection Timeout=20";
Console.WriteLine(connectionString);
for (int i = 1; i < 1001; i++)
{
using(SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
}
Console.WriteLine(i.ToString());
}
}
Thanks in advance.