Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: .NET4 XmlReader serialization , +
I'm trying to read from a webforms app in C# the BODY of the messages from the transactional system dead letter queue pre-defined by MSMQ The messages can be read ok, but when trying to read the Body property I get an exception.: InvalidOperationException, with the message {"Cannot deserialize the message passed as an argument. Cannot recognize the serialization format."}
Context: the messages I'm trying to read from the dead letter queue are messages generated via WFC service invocation using netMSMQBinding, so they are not "ordinary" messages. Our customer needs an app that allows a system administrator to read the contents of the message from the dead letter queue (that would need extra parsing of the message body I guess, IF I can finally read the darn body Smile | :) ), maybe change the original contents of the body, and then re-enquee (or delete) the message to it's original queue (or a modified copy of the original message).
I need a PoisonQueueMessage body in XML format.I tired to serialize queuemessage body but it was give an XML Exception Error Is there any way to get a body of message?
I used this Code:
public static string SerializeToString(object obj)
string xmlString = string.Empty;
StringWriter writer = null;
XmlSerializer serializer = new XmlSerializer(obj.GetType());
using (writer = new StringWriter())
serializer.Serialize(writer, obj);
xmlString = writer.ToString();
if(writer != null)
return xmlString;
Posted 20-Feb-13 7:04am
Edited 20-Feb-13 7:32am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 645
1 Maciej Los 225
2 Abhinav S 171
3 Richard Deeming 160
4 Suvendu Shekhar Giri 159
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 9,095
2 Peter Leow 5,044
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,581

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100