0
Reply

MSMQ C# Application

Rajesh Sirivella

Rajesh Sirivella

May 29 2007 3:39 AM
1.5k

Hi,

   I am trying to read the body of the message from msmq, button1_click() creates queue name vijay and send a msg to that queue.

Button2_click() should read the same queue and display the message, I am getting the following error:

 My actual requirment is BTS will be sending one msg to msmq, this msg has to be read by the .net application, update some thing in that msg and send that msg to another msmq

Can't find a formmater capable of reading this message.

can any one help

private void button1_Click(object sender, EventArgs e)

{

 

MessageQueue SndMessage = new MessageQueue(@"FORMATNAMEIRECT=OS:KOC-THA-706393\PRIVATE$\VIJAY");

SndMessage.Formatter = new XmlMessageFormatter();

SndMessage.Send(label1.Text, "Test");

}


private void button1_Click(object sender, EventArgs e)

{

 

MessageQueue SndMessage = new MessageQueue(@"FORMATNAMEIRECT=OS:KOC-THA-706393\PRIVATE$\VIJAY");

SndMessage.Formatter = new XmlMessageFormatter();

SndMessage.Send(label1.Text, "Test");

}

private void button1_Click(object sender, EventArgs e)

{

 

MessageQueue SndMessage = new MessageQueue(@"FORMATNAMEIRECT=OS:KOC-THA-706393\PRIVATE$\VIJAY");

SndMessage.Formatter = new XmlMessageFormatter();

SndMessage.Send(label1.Text, "Test");

}

 

private void button2_Click(object sender, EventArgs e)

{

MessageQueue ReadMessage = new MessageQueue(@"FORMATNAMEIRECT=OS:KOC-THA-706393\PRIVATE$\VIJAY");

System.Messaging.Message msg = new System.Messaging.Message();

msg.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });

msg = ReadMessage.Receive();

 

MessageBox.Show(msg.Body.ToString());

}