Creating a MessageQueue to a remote queue - returns error "Invalid Queue Path Name"

Posted on 2006-03-22
Last Modified: 2008-01-09
   I want to create a new MessageQueue that sends a simple message for now to a queue that resides on a networked Win CE device.
I would expect the code below to create a new message in the "Outgoing Queues" ready for when the remote device connects.

But When I attempt to send the message I get an exception thrown : exception.message = "Invalid Queue Path Name":

I have tried different Path strings :

Code is :

void SendMessage ()
   // Create new MSMQ obj..
   MessageQueue mq = new MessageQueue();

   // 'DECRT4001' is the DNS name of the Win CE device.
   mq.Path = @"DIRECT=OS:DECRT4001\Private$\test_queue";  

   // Message would be in BinaryFormat not XML.
   mq.Formatter = new BinaryMessageFormatter();
        mq.Send ("HELLO",  "TEST MESSAGE TO RT4"); // <<< Exception is throw HERE >>>
   catch ( Exception ex )
       string x = ex.Message; // <<< Message reads "Invalid Queue Path Name" >>>

Other details:
PC is Windows2000 SP4. Using Visual Studio Enterprise 2003, C# application.
Network is not on a Domain, simple Workgroup mode.
I CAN ping the Win CE device by DNS name or by IP. (Win CE v5)

(PS. I can send a MSMQ message the other way from Win CE to my C# application -  no problems.)
Question by:DavidMarkGeorge

    Author Comment

    I have now found the answer !!  

    .Net expects the Paths 'format' string different from what I have been used to in Win32 API / MFC / VB.

    The Path property should be :

    mq.Path = @"FormatName:DIRECT=OS:DECRT4001\Private$\test_queue";  


    mq.Path = @"DIRECT=OS:DECRT4001\Private$\test_queue";  

    Needed the "FormatName:" bit adding.


    Accepted Solution

    Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In one of my recent projects, I was working with IP cameras, I need to take some pictures from the camera and do some processing on it. The first step, was to retrieve the image from camera into Image object. So that it can be displayed or …
    This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now