4
Answers

MSMQ Can't Receive from Remote Queue

Taddeo

Taddeo

15y
11k
1

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) });

try

{

//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");

}

else

//It Always enters here!!!

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

if (orderQueue.CanWrite)

{

MessageBox.Show("You CAN WRITE");

}

else

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)

{

MessageBox.Show(err.Message);

}

}

Answers (4)