MSMQ MSMQMessageClass正文属性引发了类型为'System.ArgumentException'的异常 [英] MSMQ MSMQMessageClass Body property threw an exception of type 'System.ArgumentException'

查看:85
本文介绍了MSMQ MSMQMessageClass正文属性引发了类型为'System.ArgumentException'的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MSMQ(使用WCF netMsmqBinding)在客户端和服务器之间进行通信.在服务器未启动或客户端未连接到服务器的同时,客户端将这些消息推送到本地传出队列中.我希望检索(查看)消息. 来自此传出队列,以防它有一些消息排队.

I am communicating between my client and server using MSMQ (using WCF netMsmqBinding). While, the server is not up or the client is not connected to it, the client pushes these messages in a local outgoing queue. I wish to retrieve (peek) messages from this outgoing queue, in case it has some messages queued up.

出于相同的目的,我正在尝试使用以下建议的技术:

For the same purpose I am trying to use the technique as suggested at:

http://www.codeproject.com /KB/IP/MSMQ.aspx

但是从消息正文中读取时出现异常:

but I am getting an exception while reading from the message body as:

'(((MSMQ.MSMQMessageClass)(msg)).Body'引发了类型为'System.ArgumentException'的异常

'((MSMQ.MSMQMessageClass)(msg)).Body' threw an exception of type 'System.ArgumentException'

请帮我解决相同的问题!

Please help me out with a solution to the same!

谢谢

SJ

推荐答案

如果您使用的是netMsmqBinding,则最好让WCF直接处理消息的处理.  我假设您正在使用常规的System.Messaging.MessageQueue.Peek调用或类似的方法?使用netMsmqBinding 最好不要直接与队列互动,并通过WCF进行所有操作.如果您要与队列进行常规的应用程序交互,则可以考虑使用MsmqIntegrationBinding.

If you're using the netMsmqBinding, then it's best to let WCF handle the processing of the messages directly.  I'm assuming that you're using a regular System.Messaging.MessageQueue.Peek call or something similar?  With the netMsmqBinding it's best not to directly interact with the queues, and to do everything through WCF.  If you're going to have regular application interaction with the queues, then perhaps consider the MsmqIntegrationBinding.

当接收方重新联机时,将自动发送传出队列中的消息.仅对这些消息设置较低的超时时间可能更有意义,如果它们死信了,则对它们执行一些操作.

The messages in the outgoing queue will automatically get sent when the receiver comes back online.  It might make more sense to just set a low timeout on those messages, and if they dead-letter then do something with them.

我希望这会有所帮助.

 

穆罕默德·伊斯梅尔[MSFT]

Muhammed Ismail [MSFT]


这篇关于MSMQ MSMQMessageClass正文属性引发了类型为'System.ArgumentException'的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆