.net - How do I resolve a InvalidOperationException when reading MSMQ using ActiveXMessageFormatter? -
How do you avoid the InvalidOperationException created by MSMQ sender and receiver? Any help you can get will be appreciated!
I think it may be related to the sender's body type feature, but I do not know the proper domain of the attribute values.
>Sender code:
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; System Using messaging; Namespace MSMQTester {class program {static zero main (string [] ARG) {messageQQ = new message query (@ "lab exam"); Q.Formatter = new ActiveXMessageFormatter (); Message message = new message (); message. Priority = message priority High; Msg.Body = "& lt; hello_world / & gt;"; Msg.Label = "test1"; Q.Send (MSG); }}}
recipient code:
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; System Using messaging; Namespace MSMQViewer {class program {static void main (string [] args) {MessageQueue q = new MessageQueue (@ "lab test"); Q.Formatter = new ActiveXMessageFormatter (); While (true) {message message = q.Receive (); Console.WriteLine (msg.Body); Error message: C: \ dev \ MSMQTester \ MSMQViewer \ bin \ debug> MSMQViewer.exe
unchecked exception : Systems Unknown Operation Exception: Passing as an argument can not waste my ssage. Do not recognize the serial format on System.Messaging.ActiveXMessageFormatter. Reed (message message) on MSMQViewer.Program.Main (String [] args) in c: \ dev \ MSMQTester \ MSMQViewer \ Pro gram.cs: line on System.Messaging.Message.get_Body (). 18
If you also have to face this problem, then you have to use the following Can think in:
system. Messaging MessageQQ = New System Messaging Message Queue (Streakview); Queue.format = new system Messaging Active XMessageFormatter (); Queue. Default Properties Tossed. Primetime = System. Messaging Message credit High; Queue.Send ("Message as string ... no message object :(");
In the above example, I was able to pass the message while setting the highest priority While avoiding the exception.
Comments
Post a Comment