开发者

MSMQ service does not recover when restarted with Recoverable message on queue

I have a private, non-transactional message queue running on Win2008 R2. The queue breaks when I do the following:

  1. 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!

  2. Restart the Message Queue service
  3. The service does not successfully restart. The following message is logged in the Event Viewer:

    The Message Queuing service cannot start becau开发者_运维知识库se 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?


Give your machine name less than 15 characters then it will works. This is due to Netbios names can only be 15 characters or less. This was causing problems with the MSMQ Service as a result it was ending up in the inconsistent state as specified in the error. To fix this issue, uninstalled MSMQ, renamed the machine to something smaller than 15 characters and then reinstalled MSMQ. This resolved the issue.


Sounds like something is interfering with the storage files. Recoverable (which includes transactional) messages are written to files in the MSMQ\Storage directory as well as being mapped into memory. On startup, the files are reloaded to recreate the messages mapped into memory. For some reason these storage files don't work anymore.

Things I would look for:

  • Any other software that has access to the system32\msmq directory tree, such as Anti Virus products. Block these products from the directory tree.
  • Is storage on a locally attached disk or a network drive (e.g. SAN); if not local try reconfiguring MSMQ to use the local disk.
  • Is the disk error-free? Run chkdsk or similar.
  • If you create a new provate queue, does the problem affect that too?

Cheers
John Breakwell


Try moving the msmq dirctory to a different location. Maybe there is a permission problem on the disk.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜