I have a private, non-transactional message queue running on Win2008 R2. The queue breaks when I do the following:
Place a recoverable message on a queue like so:
Message msg = new Message { Body = "hello", Formatter = new XmlMessageFormatter(), Label = "Notification", Recoverable = true, AppSpecific = 123 }; mq.Send(msg);
Do not retrieve the message!
- Restart the Message Queue service
The service does not successfully restart. The following message is logged in the Event Viewer:
The Message Queuing service cannot start because a queue is in an inconsistent state. For more information, see Microsoft Knowledge Base article 827493 at support.microsoft.com.
Points to note:
- A message added to the queue this way can be successfully retrieved from the queue before restart.
- The only way I can get the queue running again is to follow these instructions: MSMQ Inconsistent State After Restart but this obviously prevents message recovery.
- If I leave Message.Recoverable = false then the service restarts successfully. But I want my messages to survive a service restart.
- I get exactly the same behaviour when I set the queue as Transactional.
Any ideas?