【问题标题】:Message queue 'number of messages' is always 0消息队列“消息数”始终为 0
【发布时间】:2011-02-18 11:34:29
【问题描述】:

我正在尝试使用 C# 在 Windows 7 上向 MSMQ 发送消息。代码如下:

using(var q = new MessageQueue(".\Private$\hellomsmq"))
{
    q.Send(new Message());
}

但是当我在计算机管理中刷新时,“消息数”(消息队列/私有队列/hellomsmq)保持为 0。执行 send() 时我没有收到任何异常/错误。

谁能帮忙。谢谢!

【问题讨论】:

  • 我必须问一个显而易见的问题。消息被消费了吗?
  • 我所做的只是在控制台应用程序中调用发送。就这些

标签: c# windows-7 msmq message-queue


【解决方案1】:

该队列是事务性的吗?如果是这样的话。我相信您必须将消息作为事务发送或使用Send 的双参数版本,MessageQueueTransactionType.Single 作为第二个参数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-24
    • 2012-01-21
    • 1970-01-01
    • 2020-11-27
    • 2014-11-05
    • 2013-03-21
    相关资源
    最近更新 更多