|
I'm observing a problem where the DTC bails after ~600s, create a console application and run this against SQL2000...
using System;
using System.Collections.Generic;
using System.Text;
using System.Transactions;
using System.Data.SqlClient;
namespace ConsoleApplicationTXtimeout
{
class Program
{
static void Main(string[] args)
{
TransactionOptions transactionOptions = new TransactionOptions();
transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
//transactionOptions.Timeout = new TimeSpan(0,0,0,30);
transactionOptions.Timeout = new TimeSpan(0);
DateTime started = DateTime.Now;
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required,transactionOptions))
{
while (DateTime.Now - started < new TimeSpan(0, 10, 0))
{
using (SqlConnection connection = new SqlConnection("Data Source=MyServer;Initial Catalog=MyDatabase;Integrated Security=SSPI"))
{
connection.Open();
SqlCommand command = new SqlCommand("Update MyTable set MyField = MyField", connection);
command.ExecuteNonQuery();
Console.WriteLine(DateTime.Now);
System.Threading. Thread.Sleep(65000);
} // end connection
} // do 10 mins worth
transactionScope.Complete();
Console.WriteLine(DateTime.Now);
} // end Tx
Console.ReadLine();
}
}
}
http://pdkm.spaces.live.com/ |