How to change System.Transactions timeout?

System.Transactions actually has two timeout values that can be specified in the configuration files.

In app.config, there is a “timeout” setting. If this setting is not specified, it defaults to 1 minute. But it can be overridden in code in the constructor for CommittableTransaction or TransactionScope.

 

In machine.config, there is a “maximum timeout” setting. If this setting is not specified, it defaults to 10 minutes. It cannot be overridden in code. It is designed to be used by the System Administrator to limit transaction timeouts. If the app.config timeout or the timeout specified in the constructors above exceed the maximum timeout in the machine.config, the timeout is adjusted down to the maximum timeout value.

How to change timeout value?

 

The default timeout for System.Transactions transactions is 1 minute. You can set it in either app config, web config, or machine config. Setting the default timeout looks like the following.

<configuration>

  <system.transactions>

  <defaultSettings timeout="00:00:30" />

  </system.transactions>

</configuration>

For System.Transactions there is also a maximum transaction timeout. That can be specified only in machine config. To change that you would specify the maxTimeout property of the machine settings section.

<configuration>

  <system.transactions>

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

  </system.transactions>

</configuration>

REFERENCE:

https://msdn2.microsoft.com/en-us/library/system.transactions.configuration.defaultsettingssection.aspx

https://msdn2.microsoft.com/en-us/library/system.transactions.configuration.machinesettingssection.aspx

Key words: Transactions MSDTC timeout System.transactions