When the code below executes,the btnSendMessage_Click method(Send Message) can complete normally.But the btnReceiveMessage_Click method blocks at 'queue.Receive();' without any exception.Why can't receive message?Do I need to configure my OS(Windows XP) yet ? Any help will be appreciated!
// Send Messageprivate void btnSendMessage_Click(object sender, System.EventArgs e){ // Open queue System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo"); // Create message System.Messaging.Message message = new System.Messaging.Message(); message.Body = txtMessage.Text.Trim(); message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)}); // Put message into queue queue.Send(message);} // Receive Messageprivate void btnReceiveMessage_Click(object sender, System.EventArgs e){ // Open queue System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(".\\Private$\\MSMQDemo"); // Receive message System.Messaging.Message message = queue.Receive(); message.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {typeof(string)}); txtReceiveMessage.Text = message.Body.ToString();}