In Focus

Forums - C# Corner

Forum guidelines


  • 0
  • 5
  • 0

MSMQ Can't Receive from Remote Queue

Feb 24 2009 11:41 AM

Hi Guys,


I'm new to the forum and I really need your help!!!

I'm stuck with a little application that I was writing to send and receive messages from my windows mobile 6.1 phone to my desktop computer....

I have been successfull to send messages from the phone to a private remote queue on my desktop (this is using wifi connection) but I can't receive it the message from the same queue!!!!

I get an error saying I don't have privileges to read the Queue... but I have set in the security tab of the Queue Full Control to ANONYMOUS USER!!!

So why it doens't work??? Please help!!!

This is the code that I'm using at the moment:


private void SendToPrivateQueueDetails()


//Machine Name

string destination = "pippo";

MessageQueue orderQueue = new MessageQueue(String.Format(System.Globalization.CultureInfo.InvariantCulture,@"FORMATNAME:DIRECT=OS:{0}\private$\myqueue", destination));

orderQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });



//Sending the Message Works

orderQueue.Send(txtSendMsg.Text, String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", "pippo-label"));

txtSendMsg.Text = "";

if (orderQueue.CanRead)


MessageBox.Show("You CAN REad");



//It Always enters here!!!

MessageBox.Show("You CANNOT READ!!!");

if (orderQueue.CanWrite)


MessageBox.Show("You CAN WRITE");



MessageBox.Show("You CANNOT WRITE!!!");

//This return the ERROR!

Message messageReceived = orderQueue.Receive(new TimeSpan(0, 0, 10));

messageReceived.Formatter = new XmlMessageFormatter(new Type[] { typeof(String) });

lblReceiveMsg.Text = (string)messageReceived.Body;



catch (Exception err)





Answers (4)


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now