【问题标题】:MSMQ sending message problem... (c#)MSMQ发送消息问题...(c#)
【发布时间】:2010-10-16 22:02:43
【问题描述】:

我的代码:

  string _path = "mymachine\\Private$\\example";
  // create a message queue object
  MessageQueue MQueue = new MessageQueue(_path);

  // create the message and set the base properties
  Message Msg = new Message("Messagem");
  Msg.ResponseQueue = MQueue;
  Msg.Priority = MessagePriority.Normal;
  Msg.UseJournalQueue = true;
  Msg.Label = "gps1";      

  // send the message
  MQueue.Send(Msg);

  // close the mesage queue
  MQueue.Close();

没有错误,但我的 MessageQueue 中没有任何内容... 有什么帮助吗?

【问题讨论】:

    标签: c# msmq


    【解决方案1】:

    我发现了问题... 我的 MessageQueue 是使用事务 true 创建的...

    【讨论】:

    • 这是一个令人讨厌的 MSMQ 问题(或 .NET 包装器,我不确定问题出在哪里)。
    • 正确。您需要将最后两个方法替换为.. MQueue.Send(Msg, transaction);事务.Commit(); MQueue.Close(); .. 否则,当你创建新队列时,关闭事务 -> New MessageQueue(_path, false);
    猜你喜欢
    • 2011-08-13
    • 2010-12-27
    • 2010-12-09
    • 2013-06-24
    • 2023-03-26
    • 2012-02-12
    • 2023-03-07
    • 1970-01-01
    • 2017-04-27
    相关资源
    最近更新 更多