Jeff
Jeff

Reputation: 13199

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/errors while performing send().

Can anyone help please. Thanks!

Upvotes: 0

Views: 603

Answers (1)

paxdiablo
paxdiablo

Reputation: 882426

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.

Upvotes: 2

Related Questions