Would a private MessageQueue object with an invalid path trigger a MessageQueueException?
First off, I have no experience with MSMQ.
Supposing an invalid path is passed into the constructor for a private MessageQueue object, would it trigger a MessageQueueException when the send method is called? If so, would the error code still be QueueNotFound? MSDN states that this error is returned for public qu开发者_运维百科eues not registered in the directory and Internet queues that do not exist in the Message Queueing namespace. However, according to what I read, a private queue is not published in the Active Directory, so I'm not sure what would happen.
I apologize if this makes no sense.
If you try to send to a queue which does not exist then the call to send will not fail as long as the queue name is in a valid format. What I mean by this is that the destination queue address does not need to exist, but the format of the queue name must be correct.
Rather, the MSMQ subsystem will queue the message locally in a temporary outbound queue, which you should be able to see appear on the box.
The reason it does this is because it thinks that the destination queue may be temporarily unavailable and when it becomes available again the message will be transmitted.
However after a period of time (can't remember default) it will move the message into the dead letter queue as undeliverable.
Hope this helps.
精彩评论