Reputation: 3755
Windows 7 32bit, .NET4. Specifically, when I do this:
_queue.Send(mqMessage);
return mqMessage.LookupId;
I get an InvalidOperationException on the access of the LookupId. The exception message is:
Lookup identifier is not defined for this message. The message was not created by a call to the Receive method, or lookup identifier was not added to the properties to retrieve.
Which to me makes it sound like the message was not successfully sent to MSMQ. I installed all MSMQ related features from the "Turn Windows Features on or Off" option in Control Panel\All Control Panel Items\Programs and Features.
If I look at my local Windows Services, I see both "Message Queuing" and "Message Queuing Triggers" started and running.
Any idea what's going on here?
Upvotes: 1
Views: 492
Reputation: 942040
This is explicitly mentioned in the MSDN Library article for Message.LookupId:
The LookupId property can only be read on messages retrieved from a queue
Only use it when you receive messages, not when you send. To make it intuitive: a sent message can be dispatched to multiple queues, each copy of the message gets its own id. There can therefore not be one unique id at the sending site.
Upvotes: 5