0

I have added a transactionscope to a function that every night clears some tables and add the new items.

The problem that I get the following error:

Inner exception: Transaction Timeout The transaction has aborted.

The job takes about 12 minutes to finish and after added the transactioncope I now get this error every time running the function.

My code:

        XalSqlDataContext db = new XalSqlDataContext();
        db.CommandTimeout = 3600;

        TransactionOptions options = new TransactionOptions();
        options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
        options.Timeout = new TimeSpan(0, 40, 0);

        using (TransactionScope txScope = new TransactionScope(TransactionScopeOption.Required, options))
        {
           //my code
        }

But I still get the timeout.

Any clues to my ms sql problem.

I was able to change the transaction timeout in the machine config for .net 2.0 to one hour without any help.

my code is running under .net 3.5 but there is not a machine.config file under my .net 3.5 folder

1 Answers1

1

The TransactionManager has a maximum timeout. Check the machine.config. I think that even if you set the timeout for your data context higher than the max it will be ignored and the machine.config value will be used so you want to adjust the machine.config file.

http://msdn.microsoft.com/en-us/library/system.transactions.transactionmanager.maximumtimeout.aspx

Paul Mendoza
  • 5,709
  • 12
  • 53
  • 82