Transactionscope错误此平台不支持分布式事务

时间:2019-05-04 06:20:27

标签: c# .net-core transactionscope

我正在使用dontnet core 2.1

我遇到以下错误,该如何解决?

  

{System.PlatformNotSupportedException:该平台不支持   分布式交易。在   System.Transactions.Distributed.DistributedTransactionManager.GetDistributedTransactionFromTransmitterPropagationToken(Byte []   传播令牌)位于   System.Transactions.TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(Byte []   传播令牌)

我的代码

try
{
    using (var s= new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
   {

       // Running couple of insert / update and delete async operations
       s.Complete();
   }
 }
 catch (TransactionAbortedException ex)
 {

 }

注意:如果我删除TransactionScopeAsyncFlowOption.Enabled,我最终会遇到另一个异常System.InvalidOperationException: A TransactionScope must be disposed on the same thread that it was created.

0 个答案:

没有答案