MSMQ在阅读消息时抱怨格式名称 [英] MSMQ complaining about format name while reading messages
问题描述
我在运行xp的远程计算机(10.3.35.3)上有一个非跨子协议的专用队列(错误).我正在尝试从运行Windows 2008的计算机上读取消息. 我正在使用"FormatName:Direct = tcp:10.3.35.3 \ Private $ \ errors"访问队列.
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.
我可以连接到它. 我可以偷看. 我有一个用于ReceiveCompleted事件的eventHandler,一旦从队列接收到一条消息,就会触发该事件,但是当我尝试将源"对象转换为messageQueue时.
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)
这时,当我尝试将源"对象转换为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.".
异常的完整堆栈跟踪
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?
注意:在此处有人说使用id代替,当我在队列的属性中查找id时,我在"Type ID:"字段中得到了全0.
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.
推荐答案
好吧,我放弃了,由于它是一个非常凌乱的旧代码的一部分,因此仍然无法正常工作.我创建了自己的小应用程序(使用相同的代码,相同的.net框架),它可以连接到远程队列并进行读取/写入/查看.所以我相信这是一个非常老的代码库在维护方面的噩梦.
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.
在研究过程中,我发现了一些有用的链接,这些链接可能会对将来在这里着陆的人有所帮助. John Breakwell以下人员为远程队列做出了贡献
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
要查看您的msmq是否以工作组模式或其他方式安装,请转到HKLM->软件-> Microsoft-> MSMQ->参数检查REG_DWORD工作组. 1是工作组模式. 0是AD模式.
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.
,如果您想知道msmq的版本,请检查此Wiki页面的版本部分
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.
这篇关于MSMQ在阅读消息时抱怨格式名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!