我在我的应用程序中设置事务时遇到问题。当我执行轻量级事务时,它可以工作:
using (TransactionScope tx = new TransactionScope())
{
// Connect to Server 1 in a transaction
tx.Complete()
}
当我进行嵌套事务时,它失败了:
using (TransactionScope tx = new TransactionScope())
{
// Connect to Server 1 in a transaction
using (TransactionScope tx2 = new TransactionScope())
{
// Connect to Server 2 in a transaction
tx2.Complete()
}
tx.Complete()
}
我得到的错误是:
The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B)
当我在服务器上运行相同的确切代码时,它可以工作。我在我的计算机上运行/配置了 MSDTC(设置与服务器相同)。
我们的网络部门说他们在防火墙上没有看到任何被阻止的流量。
我可以从我的计算机 DTC Ping 到服务器,但不能从服务器返回。
有任何想法吗?我认为这是一个网络问题,但需要一些帮助。