重新启动时 MSMQ 服务无法恢复且队列上有可恢复消息
我有一个在 Win2008 R2 上运行的私有非事务性消息队列。当我执行以下操作时,队列会中断:
将可恢复消息放入队列中,如下所示:
消息 msg = 新消息 { 正文=“你好”, 格式化程序 = new XmlMessageFormatter(), 标签=“通知”, 可恢复=真, 应用程序特定 = 123 }; mq.Send(消息);
不要检索消息!
- 重新启动 Message Queue 服务
该服务未成功重新启动。事件查看器中记录以下消息:
消息队列服务无法启动,因为队列位于 不一致的状态。有关详细信息,请参阅 Microsoft 知识库 support.microsoft.com 上的基础文章 827493。
注意事项:
- 通过这种方式添加到队列的消息可以在重新启动之前从队列中成功检索。
- 我可以让队列再次运行的唯一方法是按照以下说明进行操作: MSMQ 不一致重新启动后的状态,但这显然会阻止消息恢复。
- 如果我保留 Message.Recoverable = false,则服务将成功重新启动。但我希望我的消息能够在服务重新启动后继续存在。
- 当我将队列设置为事务性时,我得到完全相同的行为。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
给你的机器名少于 15 个字符然后它就可以工作了。这是因为 NetBIOS 名称只能是 15 个字符或更少。这导致 MSMQ 服务出现问题,最终导致错误中指定的不一致状态。要解决此问题,请卸载 MSMQ,将计算机重命名为小于 15 个字符的名称,然后重新安装 MSMQ。这解决了这个问题。
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.
听起来好像有什么东西干扰了存储文件。
可恢复(包括事务)消息将写入 MSMQ\Storage 目录中的文件并映射到内存中。
启动时,将重新加载文件以重新创建映射到内存中的消息。
由于某种原因,这些存储文件不再起作用。
我会寻找的东西:
干杯
约翰·布瑞克威尔
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:
Cheers
John Breakwell
尝试将 msmq 目录移动到其他位置。可能是磁盘权限有问题。
Try moving the msmq dirctory to a different location. Maybe there is a permission problem on the disk.