title: In SQL What is the default max transaction timeout
body: <p>What is the default value in the machine.config for <code>maxTimeout</code> (see example) if no "system.transactions" element is present on the machine.config?</p>
  
  <pre><code>&lt;system.transactions&gt;
     &lt;machineSettings maxTimeout="??:??:??" /&gt;
  &lt;/system.transactions&gt;
  </code></pre>
  
  <p>I'm asking this because the code is crashing due the following exception and it seems that it's related to the transaction exceeding a timeout, it is crashing during the <code>SaveChanges</code> method and the exception that I'm receiving is the following:</p>
  
  <pre><code>The transaction associated with the current connection has completed
  but has not been disposed. The transaction must be disposed before
  the connection can be used to execute SQL statements.
  </code></pre>
  
  <p>This is the piece of code that is crashing:</p>
  
  <pre><code>using (TransactionScope transaction = TransactionHelper.CreateTransactionScope())
  {
      using (EFContext efDBContext = new EFContext())
      {
          try
          {
              efDBContext.Connection.Open();  
  
              foreach (MyEntity currentEntity in myEntities)
              {
                  //Insertion
              }
  
              transaction.Complete();
          }
          catch (Exception ex)
          {
              //Inspect current entity
              //Get Total Time of the run
              //Number of entities processed
          }
          finally
          {
              if (esfDBContext.Connection.State == ConnectionState.Open)
                  esfDBContext.Connection.Close();
          }
      }
  }
  </code></pre>
  
  <p>This is how I create the <code>TransactionScope</code>:</p>
  
  <pre><code>public static TransactionScope CreateTransactionScope(TransactionScopeOption option = TransactionScopeOption.Required, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
  {
      var transactionOptions = new TransactionOptions()
      {
          Timeout = TimeSpan.MaxValue,
          IsolationLevel = isolationLevel
      };
  
      return new TransactionScope(option, transactionOptions);
  }
  </code></pre>