Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-03-22
2
Medium Priority
?
1,137 Views
Last Modified: 2008-01-09
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.)
0
Comment
Question by:DavidMarkGeorge
2 Comments
 

Author Comment

by:DavidMarkGeorge
ID: 16266856
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
 

Accepted Solution

by:
EE_AutoDeleter earned 0 total points
ID: 16454787
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

580 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