I have a WinForms project where I have to read massive xml files (2gb +) and store data in an MSSQL database.
After 10 minutes, I get an error message:
"The transaction associated with the current connection has been completed but has not been deleted. The transaction must be deleted before the connection is used to execute SQL statements."
I realized that this should be a timeout problem, so I did the following:
I use my code:
using (tran = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.Serializable, Timeout = TimeSpan.Zero
In my App.config, I added:
<system.transactions> <defaultSettings timeout="2:00:00"/> </system.transactions>
In my machine.config, I added:
<system.transactions> <machineSettings maxTimeout="2:00:00"/> </system.transactions>
And in MSSQL I set the remote request timeout to 0
This timeout is still happening. What am I doing wrong?
source share