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

Hi,
   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 :
@"DIRECT=OS:DECRT4001\Private$\test_queue"
and
@"DECRT4001\Private$\test_queue"

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();
   try
   {
        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.)
DavidMarkGeorgeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DavidMarkGeorgeAuthor Commented:
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";  

NOT

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

Needed the "FormatName:" bit adding.

0
EE_AutoDeleterCommented:
DavidMarkGeorge,
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.

EE_AutoDeleter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.