MSMQ: la cola de mensajes no se ha instalado en esta computadora
He escrito una aplicación de muestra para escribir en colas públicas y privadas que están en el servidor de desarrollo. No tengo la cola de mensajes instalada en mi máquina local.
Recibo un error: la cola de mensajes no se ha instalado en esta computadora.
Error está en esta línea:
MessageQueue.Exists(queueName)
Aquí está el código de prueba completo, todas las colas privadas y públicas comentadas y no comentadas están dando como resultado el mismo error. ¿Qué estoy haciendo mal aquí
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Messaging;
namespace MsmqTest
{
public partial class Form1 : Form
{
//@"DIRECT=OS:devbox01\PRIVATE$\PrivateQueueDev";
//@"DIRECT=TCP:192.168.6.102\PRIVATE$\PrivateQueueDev";
private const string QueueName = @"DIRECT=TCP:192.168.6.102\PRIVATE$\PrivateQueueDev";
//@"DIRECT=OS:devbox01\PublicQueueDev";
//@"DIRECT=TCP:192.168.6.102\PublicQueueDev";
private const string QueueNamePublic = @"DIRECT=TCP:192.168.6.102\PublicQueueDev";
public Form1()
{
InitializeComponent();
}
private void Write_Click(object sender, EventArgs e)
{
MessageQueue msgQ;
string msgText = String.Format("Message: {0}", DateTime.Now);
try
{
msgQ = GetQ(QueueNamePublic);
msgQ.Send(msgText);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
private void Read_Click(object sender, EventArgs e)
{
}
private MessageQueue GetQ(string queueName)
{
MessageQueue msgQ;
if(!MessageQueue.Exists(queueName))
{
try
{
msgQ = MessageQueue.Create(queueName);
}
catch (Exception ex)
{
throw new Exception("Error creating queue", ex);
}
}
else
{
try
{
msgQ = new MessageQueue(queueName);
}
catch (Exception ex)
{
throw new Exception("Error getting queue", ex);
}
}
return msgQ;
}
}
}