System.Transactions and Timeout
This came up a couple of times recently, so I am posting it more broadly. Courtesy of Mike Clark and Jim Carley.
System.Transactions has two timeout values that you can specify in configuration files.
The default timeout for System.Transactions transactions is 1 minute. You can set it in either app config, web config, or machine config. (You can also set the timeout for a particular transaction programmatically within the application, by using one of the appropriate constructors for TransactionScope or CommittableTransaction). Setting the default timeout to 30 seconds in config code looks like the following.
<defaultSettings timeout="00:00:30" />
For System.Transactions there is also a maximum transaction timeout. It is designed to be used by the System Administrator to limit transaction timeouts. If this setting is not specified, it defaults to 10 minutes. It cannot be overridden in code. 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. That can be specified only in machine config. To change that you would specify the maxTimeout property of the machine settings section. For example, this specifies 30 seconds:
<machineSettings maxTimeout="00:00:30" />
So, for example if your app.config setting specifies a defaultSettings timeout of zero, which implies (with a screwy sort of logic) infinite timeout, or if your application code specifies a zero timeout in one of the constructors, then the actual timeout of the transaction will not be infinite - it will be bound to the setting for machineSettings maxTimeout.
For any high-throughput transactional server, The default maxTimeout setting is probably not right for you. You're going to want to set this pretty low.
This is for any transaction managed by DTC - that would include transactions involving SQL Server, Oracle, MQ, DB2, and so on. If your transactions are timing out after 10 minutes and you want to know why, check these settings.