MSMQ Issue reading remote private queues (again)
Asked Answered
P

1

8

Ok my issue is similar to How to receive message from a private workgroup queue (and I am basically using the same code).

I am creating the queue on the host machine using

MessageQueue.Create(@".\Private$\MyNewPrivateQueue");

Opening the queue on the remote machine with

var queue = new MessageQueue(@"FormatName:DIRECT=TCP:xxx.xxx.xxx.xxx\PRIVATE$\MyNewPrivateQueue");

And writing/reading data using queue.send() and queue.Receive()

I have two systems that I am experimenting with.

  1. Windows 7 Home Premium x64
  2. Windows XP SP3

When I create the private queue on the W7 system and try to write then read the queue from the XP system (as per the referenced question) it fails with a "Message Queue Service is not available" exception on the read action.

However, when I reverse the systems (create the queue on the XP system and write/read from the W7 system, and using the same code) it works as expected.

I have worked through:

  1. Reading Messages from Remote Queues
  2. Understanding how MSMQ security blocks RPC traffic
  3. Getting MSMQ messages out of Windows Server 2008 remotely
  4. Clear the way - MSMQ coming through
  5. MSMQ 3.0 too secure for you?

I have also tried turning off the W7 and XP firewalls, and given every man and his dog full permissions on the queues themselves to no avail.

Given that it works with XP as the queue host but not with W7 as the host I assume that it s a security issue and not a code issue. But for the life of me I cannot see where in W7 the blockage is.

EDIT 8/9

OK .. adding

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\Security\AllowNonauthenticatedRPC 

Allowed me to read messages from the remote private queue. However this does not seem to allow the use of

GetPrivateQueueByMachine(String machineName)

to enumerate the available private queues. So any ideas for this one?

Pineapple answered 8/8, 2011 at 14:36 Comment(0)
P
6

OK .. I obviously didn't read all I needed to read. The answer was in:

MSMQ 4.0 - what's new in Computer Management?

I needed to add a new registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Parameters\Security\AllowNonauthenticatedRPC

and set the value to 1.

Once I did this on the W7 server, then I could read the queue from the XP machine.

Am I the only one who thinks this is weird that anyone could write to the queue, but I had to set this to read from the queue? That is so bizarre.

Pineapple answered 8/8, 2011 at 14:44 Comment(5)
Nope, not bizarre. Sending to, and receiving from, a queue use completely different network protocols. The MSMQ (and HTTP) protocol(s) are for sending/pushing messages; the RPC protocol is for receiving/pulling messages. These protocols are really chalk and cheese with completely different trouble spots.Discovery
@John .. OK given the use of 2 different protocols I can see that means different behaviours for read/write, so it is not as bizarre as I imagined. On the other hand .. two totally different protocols ;-)Pineapple
Yes :-) MSMQ was designed in the mid 1990s as a push technology for corproate LANs, before the Internet was around. RPC was already available so no need to reinvent the wheel. If MSMQ was designed in the last 5-10 years, it would be very different.Discovery
Is this the same as right-clicking on (inside Computer Management, Services and Applications) Message Queuing, Properties, Server Security tab, and clearing the "Disable un-authenticated RPC calls" checkbox?Frenchpolish
@Frenchpolish According to this link, yes: blogs.msdn.com/b/johnbreakwell/archive/2008/02/12/…Papotto

© 2022 - 2024 — McMap. All rights reserved.