×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

System.Transactions.TransactionAbortedException: The transaction has aborted. in Windows Server2003 R2

I have this codes(asp.net) working in windows XP system.. however when I deployed it to Windows Server 2003 R2, I got the
TransactionAbortedException Error...
I tried to change the machine.config to allow 10 minutes timeout, didn't work..
Any idea? Thank you.
// to update database and send out email..if the email ever fails, it rollbacks the transation.
using (TransactionScope scope = new TransactionScope())
{
try {
DAL.UpdateQry(strSQL);
}
catch (Exception ex)
{
Message.Text=ex.Message;
return;
}

try {
this.SendModifyEmail(); //email
}
catch (Exception ex)
{
Message.Text=ex.Message;
return;
}
scope.Complete();
}
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / System.Transactions.TransactionAbortedException: The transaction has aborted. in Windows Server2003 R2
    I have this codes(asp.net) working in windows XP system.. however when I deployed it to Windows Server 2003 R2, I got the
    TransactionAbortedException Error...
    I tried to change the machine.config to allow 10 minutes timeout, didn't work..
    Any idea? Thank you.
    // to update database and send out email..if the email ever fails, it rollbacks the transation.
    using (TransactionScope scope = new TransactionScope())
    {
    try {
    DAL.UpdateQry(strSQL);
    }
    catch (Exception ex)
    {
    Message.Text=ex.Message;
    return;
    }

    try {
    this.SendModifyEmail(); //email
    }
    catch (Exception ex)
    {
    Message.Text=ex.Message;
    return;
    }
    scope.Complete();
    }
    • It looks like you have two resource manager in one transaction scope so you may need XA capable resource manager driver?
      • 有道理,现学现卖,好象TransactionScope 自动升级为 distributed transaction是有条件的(只能包含ADO.NET认可的transaction).
      • I think you might be right.
        The one running on XP is the one with both database and web application on the same machine.
        The one fails on Windows Server2003 R2 is web application and database on different machines.
        Configuring XA on a live server is not a fun thing to do.. :(
        • Objects in System.Transactions use COM+ underlying.
          If it accesses remote/network transactions, it requires Microsoft Distributed Transaction Coordinator (MSDTC) support to ensure that the operations are transactionally consistent. You might need to enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.

          Since your operation is very simple. The workaroud is to use SqlTransaction. You commit the tranaction after mail function successes. You rollback the tranaction either database ooperation fails or mail function fails
          • right., Thanks. i thought transaction scope would be cleaner when i tried it on my machine.
        • 可能这个方法能解决你的问题==>INFO: Registry Entries Are Required for XA Transaction Support
          • that is good info..thanks..