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();
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();