machine.config Overrides TransactionScope / TransactionOptions.Timeout

You are wondering why your DB-transaction, startet by

using(TransactionScope scope = new TransactionScope(timeout))

runs into a timeout after 10 minutes?

Because the

<machineSettings maxTimeout="00:10:00"/>

in the system.transactions section of the machine.config has a default value of 10 minutes. And whatever is set as timeout of the TransactionScope by code – machine.config overrides it all.

So you have to change the machine.config, which does not contain a system.transaction section by default – which doesn’t mean the timeout default value does not exist.

And as long as you hadn’t set a timeout in the code, you don’t have to change any line. The new value of the machine.config is used when the process starts. No machine reboot is required.

Btw: You will find the machine config in %install path%/Config. Which is usually c:\windows\Microsoft .NET\Framework\V…\Config. On x64 machines, there is a Framework64 directory as well. My suggestion is to change all machine.config files to make sure every environment behaves in the same way.

The source of my knowledge: