ado. net - An event was unable to invoke any of the subscribers

S

ss

I am working with distributed transactions. When I open and close the
database
multiple times within one single distributed transaction, then the 11th
time
fails when the database is closed. I receive "An event was unable to
invoke any of the subscribers". Any help is greatly appreciated.
Sample version of my code is as follows:

ServiceConfig cfg = new ServiceConfig();
cfg.Transaction = TransactionOption.Required;
ServiceDomain.Enter(cfg);

for (int i = 0; i < 20; i++) {
using (SqlConnection conn = new

SqlConnection("server=.;database=pubs;Trusted_Connection=Yes;Enlist=false;"))
{
conn.Open();
conn.EnlistDistributedTransaction((ITransaction)
ContextUtil.Transaction);
using (SqlCommand cmd = new SqlCommand("update authors set au_lname =
au_lname", conn)) {
cmd.ExecuteNonQuery();
}
conn.EnlistDistributedTransaction(null);
}
}
ServiceDomain.SetComplete();
ServiceDomain.Leave();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top