我可以在TransactionScope块中使用SqlConnection.BeginTransaction吗?

时间:2014-10-09 22:10:34

标签: .net vb.net windows transactions transactionscope

我有这样的事情:

      Dim options As New TransactionOptions With {.IsolationLevel = IsolationLevel.ReadCommitted, .Timeout = TimeSpan.MaxValue}

            Using scope As New TransactionScope(TransactionScopeOption.Required, options)


                'Do some db operations
                MyLibrary.ExecuteTransaction()

                scope.Complete()
            End Using

在我的图书馆里面我有类似的东西

Public Function ExecuteTransaction()
  SqlDim transaction As SqlTransaction
            transaction = cConn.BeginTransaction("MyTransaction")
  'Do some db operations
  transaction.commit()
End Function

但有时我在MyLibrary中有一个例外:

Communication with the underlying transaction manager has failed.
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)

我将我的Application Server放在一台机器和我的数据库服务器和另一台机器上。 MSDTC在bouth服务器中配置为接受远程事务。

¿任何人都可以帮助我吗?

0 个答案:

没有答案