Export (0) Print
Expand All
Expand Minimize

Troubleshooting Exceptions: System.Messaging.MessageQueueException

A MessageQueueException exception is thrown if a Microsoft Message Queuing internal error occurs.

Check the MessageQueueErrorCode property of the exception to determine why the MessageQueue operation failed.

Exceptions associated with the MessageQueueException class are generated by internal errors within Message Queueing that should be dealt with programmatically. Every exception consists of an error code and a text string that describes the source. For a list of these error codes and their descriptions, see MessageQueueErrorCode.


If a MessageQueue opens a queue with the sharedModeDenyReceive parameter set to true, any MessageQueue that subsequently tries to read from the queue generates a MessageQueueException exception because of a sharing violation. The same exception is thrown if a MessageQueue tries to access the queue in exclusive mode while another MessageQueue already has nonexclusive access to the queue.

Visual Basic noteVisual Basic Note

MessageQueueTransaction is threading-apartment–aware. Visual Basic sets the state of the main thread to STA, so you must apply the MTAThreadAttribute in the Main subroutine. Otherwise, sending a transactional message using another thread throws a MessageQueueException exception.

Community Additions

© 2015 Microsoft