有几天我遇到了TransactionScope的问题。错误信息如下:
MassTransit.Context.ServiceBusReceiveContext Consumer Exception Exposed System.Transactions.TransactionAbortedException: The transaction has aborted.
at System.Transactions.TransactionStatePromotedAborted.CreateAbortingClone(InternalTransaction tx)
at System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel, InternalTransaction internalTransaction, Boolean blocking)
at System.Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)
at System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)
at System.Transactions.TransactionScope.PushScope()
at System.Transactions.TransactionScope..ctor(TransactionScopeOption scopeOption, TransactionOptions transactionOptions, TransactionScopeAsyncFlowOption asyncFlowOption)
at MassTransit.Transports.Msmq.TransactionalInboundMsmqTransport.ReceiveMessage(MessageEnumerator enumerator, TimeSpan timeout, Action`1 receiveAction) in d:\BuildAgent-03\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.Msmq\TransactionalInboundMsmqTransport.cs:line 48
at MassTransit.Transports.Msmq.InboundMsmqTransport.<>c__DisplayClass2.<EnumerateQueue>b__0(MessageQueueConnection connection) in d:\BuildAgent-03\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.Msmq\InboundMsmqTransport.cs:line 96
at MassTransit.Transports.DefaultConnectionPolicy.Execute(Action callback) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Transports\DefaultConnectionPolicy.cs:line 42
at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 50
at MassTransit.Transports.ConnectionHandlerImpl`1.Use(Action`1 callback) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 93
at MassTransit.Transports.Msmq.InboundMsmqTransport.EnumerateQueue(Func`2 receiver, TimeSpan timeout) in d:\BuildAgent-03\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.Msmq\InboundMsmqTransport.cs:line 119
at MassTransit.Transports.Msmq.InboundMsmqTransport.Receive(Func`2 callback, TimeSpan timeout) in d:\BuildAgent-03\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.Msmq\InboundMsmqTransport.cs:line 45
at MassTransit.Transports.Transport.Receive(Func`2 callback, TimeSpan timeout) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Transports\Transport.cs:line 59
at MassTransit.Transports.Endpoint.Receive(Func`2 receiver, TimeSpan timeout) in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 351
at MassTransit.Context.ServiceBusReceiveContext.ReceiveFromEndpoint() in d:\BuildAgent-03\work\aa063b4295dfc097\src\MassTransit\Context\ServiceBusReceiveContext.cs:line 91
队列清晰,意味着下次交易成功(我认为)。 没有相关的堆栈跟踪。也许ThreadPooling可能与此有关?
这个错误突然开始出现,有几天了。负责处理交易的代码没有变化。
我需要帮助。任何人吗?
更新1:
在生产服务器上抛出此异常,但我无法在登台服务器或开发计算机上重现它。
更新2:
所有交易均为本地交易。
答案 0 :(得分:0)
这听起来像是Microsoft DTC(分布式事务协调器)的问题,在这种情况下,您可能在读取消息时使用与SQL服务器的连接,并且该连接无法登记到分布式事务中。 / p>
有许多与MS DTC相关的故障排除指南,因此您可能会考虑检查DTC操作,安全性和连接性。帐户可能已过期,防火墙规则已更改,或者某个节点上未启动服务。
答案 1 :(得分:0)
问题出在有缺陷的StructureMap中。升级后一切正常。