Search code examples
c#.nettransactionscope

What happens when a TransactionScope times-out


In C# I am using the TransactionScope(). If the TransactionScope() times-out does the transaction get committed or is it rolled back?


Solution

  • The standard time-out value is 10 minutes. If the TransactionScope time-out is triggered, the transaction will do a roll-back. If you didn't commit the transaction, the state will not change (ACID principles).

    ACID-principles on Wiki: https://en.wikipedia.org/wiki/ACID

    It is possible to change the time-out in your .config file using the maxTimeout. https://msdn.microsoft.com/en-us/library/system.transactions.configuration.machinesettingssection.maxtimeout(v=vs.110).aspx