重新启动时 MSMQ 服务无法恢复且队列上有可恢复消息

发布于 2024-11-24 12:01:34 字数 817 浏览 0 评论 0原文

我有一个在 Win2008 R2 上运行的私有非事务性消息队列。当我执行以下操作时,队列会中断:

  1. 将可恢复消息放入队列中,如下所示:

    消息 msg = 新消息
    {
      正文=“你好”,
      格式化程序 = new XmlMessageFormatter(),
      标签=“通知”,
      可恢复=真,
      应用程序特定 = 123
    };
    
    mq.Send(消息);
    

    不要检索消息!

  2. 重新启动 Message Queue 服务
  3. 该服务未成功重新启动。事件查看器中记录以下消息:

    消息队列服务无法启动,因为队列位于
    不一致的状态。有关详细信息,请参阅 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:

  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 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

救赎№ 2024-12-01 12:01:34

给你的机器名少于 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.

南笙 2024-12-01 12:01:34

听起来好像有什么东西干扰了存储文件。
可恢复(包括事务)消息将写入 MSMQ\Storage 目录中的文件并映射到内存中。
启动时,将重新加载文件以重新创建映射到内存中的消息。
由于某种原因,这些存储文件不再起作用。

我会寻找的东西:

  • 任何其他可以访问 system32\msmq 目录树的软件,例如防病毒产品。从目录树中阻止这些产品。
  • 存储在本地连接的磁盘或网络驱动器(例如 SAN)上;如果不是本地,请尝试重新配置 MSMQ 以使用本地磁盘。
  • 磁盘没有错误吗?运行 chkdsk 或类似命令。
  • 如果您创建一个新的验证队列,该问题是否也会影响它?

干杯
约翰·布瑞克威尔

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

焚却相思 2024-12-01 12:01:34

尝试将 msmq 目录移动到其他位置。可能是磁盘权限有问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文