简体   繁体   English

邮件队列“邮件数”始终为0

[英]Message queue 'number of messages' is always 0

I am trying to send messages to MSMQ on Windows 7 using C#. 我正在尝试使用C#将消息发送到Windows 7上的MSMQ。 The code is as below: 代码如下:

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

But when I refresh in Computer Management the 'number of messages' (Message Queuing/Private Queues/hellomsmq) stays at 0. I did not get any exceptions/errors while performing send(). 但是,当我在“计算机管理”中刷新时,“消息数”(消息队列/专用队列/ hellomsmq)保持为0。执行send()时没有任何异常/错误。

Can anyone help please. 谁能帮忙。 Thanks! 谢谢!

Is that queue transactional? 那个队列是事务性的吗? If so. 如果是这样的话。 I believe you have to send your message as a transaction or use the two-parameter version of Send with MessageQueueTransactionType.Single as the second parameter. 我相信您必须将消息作为事务Send ,或者使用带有MessageQueueTransactionType.Single的两个参数版本的Send作为第二个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM