Why does MSMQ think I'm on a workgroup computer?

前端 未结 8 1481
孤独总比滥情好
孤独总比滥情好 2020-12-15 05:42

My computer is connected to a domain, but when I go to create a public queue:

MessageQueue.Create(@\".\\testqueue\");

I get this error:

8条回答
  •  别那么骄傲
    2020-12-15 06:13

    I was facing the same problem, take a look at solution below. I don't know the reason but creating queue in this manner works perfectly.

    private MessageQueue messageQueue;
    public const string DEFAULT_QUEUE_NAME = "newQueue";
    public const string QUEUENAME_PREFIX = ".\\Private$\\";
    
    public static string QueueName
    {
        get
        {
            string result = string.Format("{0}{1}", QUEUENAME_PREFIX, DEFAULT_QUEUE_NAME);
            return result;
        }
    }
    
    public void SendMessage()
    {
        string queuePath = QueueName;
        MessageQueue  messageQueue = MessageQueue.Create(queuePath);
        messageQueue.Send("msg");            
    }
    

    you can create queue for receiving message in the same manner.

提交回复
热议问题