2

When I try to open two different SqlConnections inside a TransactionScope on Windows 10, I got an exception on the opening of the second connection.

The same code on a Windows Server 2016 works fine.

This error happened this week 2018-11-23 (I suspect a windows update)

Exception details: System.Data.SqlClient.SqlException: 'Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.'

Code sample :

using System;
using System.Data.SqlClient;
using System.Transactions;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var transactionScope = new TransactionScope())
            {
                using (var connection = new SqlConnection("Data Source=localhost,1433;Initial Catalog=DataAccessIntegrationTests;User Id=MyUser;Password=MyPassword;"))
                {
                    connection.Open();
                    using (var connection2 = new SqlConnection("Data Source=localhost,1433;Initial Catalog=DataAccessIntegrationTests;User Id=MyUser;Password=MyPassword;"))
                    {
                        connection2.Open();
                    }
                }
            }
            Console.WriteLine("Everything is ok...");
            Console.ReadLine();
        }
    }
}
NicosNet
  • 21
  • 2

0 Answers0