即時通訊創建一個C#和WCF服務,它從MSMQ中接收消息。交易異常中止
這是使用事務性MSMQ。在業務邏輯中,有一個條件和條件,然後在另一個事務隊列中放置一條新消息,但是我似乎總是會拋出異常並且不確定從這裏去哪裏
「System.Transactions.TransactionAbortedException:在System.Transactions.DependentTransaction..ctor(IsolationLevel isoLevel,InternalTransaction internalTransaction,布爾阻塞)上的System.Transactions.TransactionStatePromotedAborted.CreateAbortingClone(InternalTransaction tx)\ r \ n \ r \ n在系統上\ r \ n .Transactions.Transaction.DependentClone(DependentCloneOption cloneOption)\ r \ n在System.Transactions.TransactionScope.SetCurrent(Transaction newCurrent)\ r \ n在System.Transactions.TransactionScope.PushScope()\ r \ n在System.Transactions.TransactionScope ..(TransactionScopeOption scopeOption)\ r \ n在TMC.Services.Implementation.In boundMessageHandler.Msmq.MsmqDispatcher.Dispatch(字符串queueFormatAndLocation,對象itemToPlaceOnQueue,布爾traceMessage)在E:\ MSMQ \ MsmqDispatcher.cs:線39 \ r \ n在TMC.Services.Implementation.InboundMessageHandler.OmhDispatcher.AckNackDispatcher.SendAckTo
Tg(SendAckToTgRequest請求)在E:\ AckNackDispatcher.cs:38行「
任何想法?
當把它放在隊列中的代碼:
var queue = new MessageQueue(queueFormatAndLocation);
var msg = new System.Messaging.Message {Body = itemToPlaceOnQueue, Priority = MessagePriority.High, UseDeadLetterQueue = true, UseTracing = traceMessage};
using (var ts = new TransactionScope(TransactionScopeOption.Required))
{
queue.Send(msg, MessageQueueTransactionType.Automatic); // send the message
ts.Complete(); // complete the transaction
}
在queueFormatAndLocation而言,這是正確的:
「FORMATNAME:直接= OS:。\ PRIVATE $ \ AckMsgs 「