问题
I have a non transacitonal private queue(errors) on a remote machine(10.3.35.3), running xp. I am trying to read messages from a machine which runs windows 2008. I am using "FormatName:Direct=tcp:10.3.35.3\Private$\errors" to access the queue.
I can connect to it. I can peek. I have a eventHandler for ReceiveCompleted event, and it get fired once there is a message received from queue, however when I try to convert "source" object to messageQueue.
Friend Sub MyReceiveCompleted(ByVal [source] As [Object], ByVal asyncResult As ReceiveCompletedEventArgs)
Dim objMessageQueue As MessageQueue
Try
objMessageQueue = New MessageQueue
objMessageQueue = CType([source], MessageQueue)
At this point when I try to convert "source" object to MessageQueue object I got exception "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.".
full stack trace of exception
at System.Messaging.MessageQueue.GenerateQueueProperties()
at System.Messaging.MessageQueue.get_QueuePath()
at System.Messaging.MessageQueue.get_QueueName()
at MyReceiveCompleted(Object source, ReceiveCompletedEventArgs asyncResult)
I have tried different format names, no luck. can anyone please explain what is wrong in here? is there any other format name I need to use? can we know what formatname a queue will like beforehand?
Note: in here someone said to use id instead, when I look for id in properties of queue I got all 0s in "Type ID:" field.
回答1:
Ok I give up on this, it is still not working becuase it is part of a very messy old code. I created my own little application(using the same code, same .net framework) and it can connect to remote queues and read/write/peek. so I believe this was an example of maintenance nightmare of a very very old code base.
during my research I have found some useful links, which may help someone who lands here in future. John Breakwell has following to contribute about remote queue
There is a new security in MSMQ4.0
A registry key in MSMQ3.0
some ports info regarding msmq
some more info about remote msmq 4.0 processing
To see if your msmq is installed in workgroup mode or other one, goto HKLM->Software-> Microsoft->MSMQ->Parameters check REG_DWORD workgroup. 1 is workgroup mode. 0 is AD mode.
and if you want to know the version of your msmq, check version section of this wiki page
I almost forgot to mention that as a rule of thumb I believe we should always read local and write remote, not other way round.
来源:https://stackoverflow.com/questions/23669683/msmq-complaining-about-format-name-while-reading-messages