Q: Accessing MSMQ on WinXP Pro from a docked WM5 device

  • Thread starter Thread starter Adam Bradley
  • Start date Start date
A

Adam Bradley

Hi all,

Not having amu success making a connection using C# from a WM5 device to
a Windows XP Pro using ActiveSync inside of VS2005.

AS is working fine, I can connect to a local Queue, but I'm simply
unable to connect to a Queue on the host Windows XP Pro.

I'm currently using

MessageQueue(@"FormatName:DIRECT=OS:XPBASE\\PRIVATE$\\MYOBQueue")
and have tried
MessageQueue(@"FormatName:DIRECT=OS:XPBASE\PRIVATE$\MYOBQueue");
MessageQueue(@"FormatName:DIRECT=OS:\\\\XPBASE\\PRIVATE$\\MYOBQueue");

and I receive

"MessageSystem.Messaging.MessageQueueException: The queue does not exist
or you do not have sufficient permissions to perform the operation. at
MQCacheableInfo.get_WriteHandle() at
System.Message.MessageQueue.StaleSafeMessage() at
System.Messaging.MessageQUeue.SendInternal()..."

Windows Firewall is turned off, anything else I need to do? I suspect
it might be something security related in the configuration of the Queue
on the Windows box.

Anyone?

Regards,
Adam
 
I would guess your have binary protocol disabled in MSMQ configuration. You
can check out this on MSMQ information:


http://blogs.msdn.com/ihimmar/archive/2004/06/14/154909.aspx
http://blogs.msdn.com/ihimmar/archive/2004/06/14/154911.aspx

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Ilya said:
I would guess your have binary protocol disabled in MSMQ configuration. You
can check out this on MSMQ information:


http://blogs.msdn.com/ihimmar/archive/2004/06/14/154909.aspx
http://blogs.msdn.com/ihimmar/archive/2004/06/14/154911.aspx

Ilya,

Thanks for your response, I've made the change but am not having
any success. I enabled the Journal but have no entries in the
Journal Queue.

To try and workaround any security related issues, I made "Anonymous" a
member of the "Everyone" group by following the following KB article
http://support.microsoft.com/kb/278259/

I found the complete set of registry settings at
http://msdn.microsoft.com/library/d.../en-us/wcemsmq/html/coconmsmqregistrykeys.asp

Any idea how I might go about debugging this? Any way of sniffing the
loopback adapter? TDImon gave me:

---snip---
4 4.50025129 System:4 82EE6028 TDI_SEND_DATAGRAM
UDP:172.17.2.131:137 172.17.2.2:137 SUCCESS Length:68

5 5.38050646 rapimgr.exe:1644 83128540 TDI_SEND TCP:127.0.0.1:990
SUCCESS Length:4

6 5.38934725 wcescomm.exe:860 82CB8210 TDI_SEND TCP:127.0.0.1:1097
SUCCESS Length:4

7 6.00105935 System:4 82EE6028 TDI_SEND_DATAGRAM
UDP:172.17.2.131:137 172.17.2.2:137 SUCCESS Length:68
---snip---

Where the first IP address is source IP:Port and second is
remote IP:Port

Regards,
Adam
 
Ilya,

Its getting better!
Thanks for your response, I've made the change but am not having
any success. I enabled the Journal but have no entries in the
Journal Queue.

To try and workaround any security related issues, I made "Anonymous" a
member of the "Everyone" group by following the following KB article
http://support.microsoft.com/kb/278259/

I can now obtain a connection to the Queue after setting the binary mode
(my registry editor didn't save the value unless you told it do to so
explicitly - sorted!) - however, no messages appear in the remote queue :|

When I trace in the debugger "myQueue" has the properties
attached - false
CanRead - false
CanWrite - true

On calling myQueue.Send(message) I receive no error.

Weird? Any idea what's going on?
Thanks in advance.

Adam
 
Adam said:
I can now obtain a connection to the Queue after setting the binary mode
(my registry editor didn't save the value unless you told it do to so
explicitly - sorted!) - however, no messages appear in the remote queue :|

When I trace in the debugger "myQueue" has the properties
attached - false
CanRead - false
CanWrite - true

On calling myQueue.Send(message) I receive no error.

Weird? Any idea what's going on?
Thanks in advance.

In order to debug the issue, I'm trying now to configure and reference
the Dead Letter queue in .NET CF 2.0.

I've been using

MessageQueue myDeadLetterQueue = new MessageQueue(@".\DeadLetter$");

but this doesn't see to work, anyone have any ideas?

Thanks again!
Adam
 
It's likely you having normal networking issues. MSMQ is store-and-forward,
so you can send messages even if queue does not really exist, messages
simply won't be ever delivered.

If queue exists but messages are not delivered, that means MSMQ can't
connect. Please go ahead and do usual network diagnostics with pinging and
port scanning. Also try sending messages from another PC.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Adam Bradley said:
On calling myQueue.Send(message) I receive no error.

Weird?

No not really.

When Send returns successfully you know that your local MSMQ Queue manager
has taken the message and will make every effort to deliver it - that does
not mean that delivery will be successful.

For example, you might use an invalid system name in the formatname which
would mean the message could never be delivered (since the apparent
destination does not exist). Or, the message might be delivered to the
destination system but the destination system's Queue Manager might not be
able to deliver the message to the destination queue - for example because
the queue does not exist when the message arrives at the destination system
or because the queue's security does not allow the sender to send messages
to the queue.
Any idea what's going on?

The easiest way to tell what is going on is to set the "UseJournalQueue"
Message property before sending the message and then look in the journal
queues of both the sending and destination systems to see if there is any
indication of a problem. These messages are placed into the Journal queue
local to the Queue Manager that determines a failure has occurred.
 
Frank Boyne said:
The easiest way to tell what is going on is to set the "UseJournalQueue"

I mean "UseDeadLetterQueue" not UseJournalQueue, sorry.
These messages are placed into the Journal queue local to the Queue
Manager that determines a failure has occurred.

That should read ... placed into the Dead letter Queue local to ...
 
Adam Bradley said:
In order to debug the issue, I'm trying now to configure and reference the
Dead Letter queue in .NET CF 2.0.

Before you go too far down that path, try looking at the DLQ on the
destination system. You can do that from the Computer Management tool in
Administrative Tools, just expand Services and Applications, then expand
Message Queuing and finally expand System Queues. Click on Dead-letter
messages to see the contents of the DLQ.

More failures occur at the destination end than at the originating end so
checking XP first is more likely to find your problem, and it's easier too
since you can use the Computer Management UI.
I've been using

MessageQueue myDeadLetterQueue = new MessageQueue(@".\DeadLetter$");

but this doesn't see to work, anyone have any ideas?

That works for .NET Framework on Windows XP - but it is possible that CF (or
MSMQ on CE) is different. You might try explicitly spelling out the local
system name rather than using a period (.) on the off chance that CF or CE
doesn't support that convention.

You could also try using a Direct Format Name rather than a path name to
open the DLQ in case the CF or CE doesn't support path names to DLQs. The
DFN would look something like this...
DIRECT=AddressSpecification\SYSTEM$;DEADLETTER
 
Frank said:
I mean "UseDeadLetterQueue" not UseJournalQueue, sorry.

Thought as much!
That should read ... placed into the Dead letter Queue local to ...

Still no luck I'm afraid. Following are my attempts at the correct
naming for .NET CF2

MessageQueue(@"FormatName:DIRECT=OS:WM_Administrat1\system$;deadletter");
MessageQueue(@"DIRECT=WM_Administrat1\SYSTEM$;DEADLETTER");
MessageQueue(String.Format(System.Globalization.CultureInfo.InvariantCulture,
@"FORMATNAME:DIRECT=OS:{0}\SYSTEM$;DEADLETTER;XACTONLY", deviceIP));

MessageQueue(@"FORMATNAME:DIRECT=TCP:{0}\SYSTEM$;DEADLETTER;XACTONLY");
MessageQueue(@"FORMATNAME:DIRECT=TCP:{0}\SYSTEM$;DEADLETTER;XACTONLY");
MessageQueue(@"FormatName:DIRECT=OS:WM_Administrat1\SYSTEM$;DEADLETTER;XACTONLY");
MessageQueue(@".\SYSTEM$;DEADLETTER");

Unfortunately, none seem to work. To reiterate, I'm trying to retrieve
the contents of the DLQ on the handheld device. To confirm, the DLQ is
created during the standard WM5 MSMQ install?

Writing to a local queue of .NET CF2 works happily using

MessageQueue(@".\private$\MyQueue");

I've been attempting to write to a queue on the Windows XP box where the
device is cradeled (albeit the WM5 emulator) using

MessageQueue(@"FormatName:DIRECT=OS:XPBASE\private$\testq");

to no avail.

I was having a look at the MSMQSample.zip.exe (can't for the life of me
find it since I downloaded it (I've made it available at
http://svn.adamjbradley.com:8888/WebDAV/anonymous/)

It makes the following references
---snip---
//The response Queue is specified to receive acknowledgement from the
// server
message.ResponseQueue = new MessageQueue
(String.Format(System.Globalization.CultureInfo.InvariantCulture,
@"FORMATNAME:DIRECT=TCP:{0}\private$\mqdemoAck",deviceIP));
---snip---

and

---snip---
//Create an instance of the MessageQueue class that abstracts a
//connection to a queue specified on the server
MessageQueue orderQueue = new MessageQueue
(String.Format(System.Globalization.CultureInfo.InvariantCulture,
@"FORMATNAME:DIRECT=OS:{0}\private$\mqsample", textBoxServer.Text));
---snip---

if you could provide any code that would allow me to view the local DLQ
would be wonderful :)

Thanks in advance.

Adam
 
I almost hate to say it because I'm not a MSMQ expert by any stretch of the
imagination, but you might verify what capabilities MSMQ on Windows CE has
for the CE version you're using. It used to be that only private$ queues on
remote machines were accessible. I don't use MSMQ on a daily basis, so I
haven't kept up with what might have been added for CE5. In CE4.2, the PC
name, the NetBIOS name, was used to identify where the queue should go. I
can't tell from your description if XPBASE fits that model.

Paul T.
 
After a few coffee's and a bit of time I can now report back and saying
its working!

By retrieving the IP address of the host the device is connected to
(over ActiveSync) by using the "ppp_peer" trick.

---snip---
IPHostEntry iph = System.Net.Dns.GetHostByName("ppp_peer");
---snip---

then pushing the message into a queue

---snip---
MessageQueue myQueue = new MessageQueue(@"FORMATNAME:DIRECT=TCP:" +
hostIP + @"\private$\testq");
---snip---

Works perfectly.

However, I still have no way of referencing the local DLQ on the
WM device.

I've tried a few different ways as you can see below (the createQueue
method just takes this string and does a check to see if I get a non
-null readPointer value on my newly created Queue object)

---snip---
createQueue(@"FormatName:" + computerGUID.ToString() + @";DEADLETTER");
createQueue(@"FormatName:" + computerGUID.ToString() + ";DEADLETTER");

createQueue(@"FormatName:DIRECT=OS:" + "WM_Administrat1" +
@"\SYSTEM$;DEADLETTER");
createQueue(@"FormatName:DIRECT=OS:WM_Administrat1" +
@"\SYSTEM$;JOURNAL");
createQueue(@".\SYSTEM$;DEADLETTER");
createQueue(@"FORMATNAME:DIRECT=OS:WM_Administrat1\SYSTEM$;DEADLETTER");

createQueue(@"FORMATNAME:DIRECT=OS:WM_Administrat1\SYSTEM$;DEADLETTER;XACTONLY");

createQueue(@"FORMATNAME:DIRECT=TCP:{0}\SYSTEM$;DEADLETTER;XACTONLY");

createQueue(@"FORMATNAME:DIRECT=TCP:{0}\SYSTEM$;DEADLETTER;XACTONLY");

createQueue(String.Format(System.Globalization.CultureInfo.InvariantCulture,
@"FORMATNAME:DIRECT=OS:{0}\SYSTEM$;DEADLETTER;XACTONLY", deviceIP));

createQueue(@"FORMATNAME:DIRECT=WM_Administrat1\SYSTEM$;DEADLETTER");

createQueue(@"FORMATNAME:DIRECT=OS:WM_Administrat1\system$;deadletter");

---snip---

Anyone? I need to have some way of working out if the message did in
fact get to the other end :)

Adam
 
Hello folks,
Not sure if I was in the same context. However I got caught in a situation with MSMQ where I had a queue with
CanRead - false
CanWrite - true
In my case this was because the queue had been created by a service (which I wrote in .NET C#) that was running under Local System account. My service could write to that queue, but I as administrator had no read access to it... I couldn't delete it either. In the properties , security, I found a strange user S-1-5-32-554 with a question mark, and I couldn't change the security settings. This was very puzzling.
I resolved it by temporarily adding a line in my service code to delete that queue:
MessageQueue.Delete(@".\private$\myQueueName");
As this was also done with the Local System account, it worked, it successfully deleted that queue. Then I created it newly manually as administrator, and had no more problem with it.
 
Back
Top