Message queue 'number of messages' is always 0
I am trying to send messages to MSMQ on Windows 7 using C#. 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/err开发者_开发百科ors while performing 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.
精彩评论