Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSMQ Issue reading remote private queues (again)

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?

like image 659
Peter M Avatar asked Aug 08 '11 14:08

Peter M


1 Answers

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.

like image 56
Peter M Avatar answered Oct 07 '22 23:10

Peter M