Connecting Tech Pros Worldwide Forums | Help | Site Map

not able to receive a .txt file from a message queue (MSMQ)

Newbie
 
Join Date: Nov 2009
Posts: 1
#1: 3 Weeks Ago
Hi ,

I am able to send a text file (.txt) to a message queue (MSMQ).
But i am not able to receive the .txt file from the message queue. Please help how to proceed.

I am Using BodyStream property to send the content of the text file. In the message queue am able to see the content data present. I think by default MSMQ uses xmlformatter.

Below is code for sending i have used
-------------------------------------------------------
System.Messaging.Message mm = new System.Messaging.Message();
string path = @"EDID93ADES.txt";
System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.Open);
mm.BodyStream = stream;
mm.Label = System.IO.Path.GetFileName(path);
mm.Priority = MessagePriority.Normal;
mq.Send(mm);

for Receiving the code i have used
-------------------------------------------------

System.Messaging.Message mes;
string m;
mq1 = new System.Messaging.MessageQueue(@".\Private$\MyQueue ");
try
{

mes = mq1.Receive(new TimeSpan(0, 0, 3));
mes.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
m = mes.Body.ToString();


}
catch
{
m = "No Message";
}

Please help out of this...

It will be a great help full

Thanks,
Thaj

Reply