Recently when I was working with WCF-SAP Adapter I got the below error

System.Transactions.TransactionException: The operation is not valid for the state of the transaction. --->
System.TimeoutException: Transaction Timeout
  
--- End of inner exception stack trace ---
  
at
System.Transactions.TransactionState.EnlistVolatile(InternalTransaction tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
  
at
System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
  
at
Microsoft.BizTalk.Adapter.Wcf.Runtime.TransmitTxnBatch..ctor(IBTTransportProxy transportProxy, ControlledTermination control, Transaction transaction)
  
at
Microsoft.BizTalk.Adapter.Wcf.Runtime.BizTalkDeleteTxn.Execute(BizTalkExecutionContext executionContext)
.

And this error was intermittent, this was occurring only for large sized IDOCS. When I checked SAP system I found that the operation at SAP end took longer time than expected. An another interesting fact was that I received the error in biztalk after the SAP got processed the idoc.

After some research I found that the connection is broken if the operation takes more time than that specified in the SendTimeout of the WCF-SAP send port properties.

After increasing the SendTimeout property it was still not reflecting.
After some research I found that according to the link http://blogs.msdn.com/b/adapters/archive/2008/01/28/timeoutexception-s-timeout-related-argumentoutofrangeexception-s-thrown-from-the-sap-adapter.aspx that some of the Timeout property doesn’t get reflected.

So I added below entries in framework64 .net 4.0  machine.config file(C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config) which will change the timeout setting for entire System.Transactions Namespace.

<configuration>
<system.transactions>|
  <machineSettings maxTimeout="00:59:00" />
</system.transactions>
</configuration> 

 After making this Changes my BizTalk Application which was failing, worked as expected.

Happy Biztalking!!

Written by
Shashidharan Krishnan

Reviewed by
Jainath V R 

Microsoft India GTSC