What can cause "Cannot import the transaction" errors when receiving from MSMQ?

0

The other day I received these errors trying to receive messages from transactional, public queues.

System.Messaging.MessageQueueException (0x80004005): Cannot import the transaction.
   at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
   at System.Messaging.MessageQueue.Receive(TimeSpan timeout, MessageQueueTransactionType transactionType)

This is an application that has been running for years, 24/7, and this is the first time the error occurred. The app is configured to shut itself down after a couple of repeated errors like this, but when it was restarted some 15 minutes later, everything worked fine again.

Fwiw, the app is receiving from 3 different queues, on a per-queue dedicated thread. The error occurred on all 3 threads, and between every error (retrying without pausing in-between), there was an interval of between 1 and 2 seconds, and this error state went on for about 6 seconds, before the app shut itself down.

I do not expect a distributed transaction to occur in this app, but I do not explicitly set TransactionScopeOption to RequiresNew either.

I cannot seem to find a detailed explanation of that error and would like to know how to get to the bottom of this temporary glitch.

Does this error only occur for transactions involving DTC? Or could it occur for internal transactions as well?

c#
msmq
msdtc
asked on Stack Overflow Mar 22, 2020 by Evgeniy Berezovsky • edited Mar 23, 2020 by Evgeniy Berezovsky

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0