Goal: to limit the duration of a Sql Server transaction that was initiated on an Asp.Net web page.
A transaction is more than a single command, so SqlCommand.CommandTimeout is not strong enough.
Scenario: an Asp.Net page does something like this:
SqlConnection connection = new SqlConnection("yourserver");
connection.Open();
tran1 = connection.BeginTransaction();
command.Transaction = tran1;
command.CommandText = "select lots of stuff";
command.ExecuteScalar()
command.CommandText = "select some more stuff";
command.ExecuteScalar()
command.CommandText = "update some stuff";
command.ExecuteScalar()
tran1.Commit();
connection.Close();
If all the work takes far too long, locking resources along the way, then we want that transaction to be aborted, wherever it is at, either by Sql Server itself, or by Asp.Net. Also if the client machine that initiated it fell out of the window.
If Asp.Net aborts execution, but leaves the transaction open, or the Sql Command running, then that's not good enough. It's all about protecting all other users from too heavy work by one individual. That inividual then needs to reconsider the size of his work, break it up into smaller chunks.
In Asp.Net I've looked at ExecutionTimeout, ScriptTimeout, CommandTimeout. In Sql Server I've looked at QUERY_GOVERNOR_COST_LIMIT and LOCK_TIMEOUT.
None of these seem to achieve the goal.
Any ideas?