问题
I have a private queue on a remote machine that everyone and the anonymous login have full access to. The following code produces and error when trying to receive:
var qpath = @"FormatName:DIRECT=TCP:xx.xx.xx.xx\PRIVATE$\QueueName";
var q = new MessageQueue(qpath);
var msg = new Message();
msg.AttachSenderId = false;
msg.Recoverable = true;
msg.Body = "hello";
q.Send(msg); // <-- this works!
var recMsg = q.Receive(TimeSpan.Zero); // <-- this breaks! :|
- The Error message is: Message Queue service is not available.
- The sent message are ending up in the queue on the remote machine
- The same happens when using OS:MachineName instead of TCP:xx.xx.xx.xx
- The queue server is not part of the domain.
Any ideas?
回答1:
If the remote machine is part of a different domain then:
MSMQ 3.0 applications running on cross-forest computers running a member of the family in non-trusted domains will use the secured remote read API. By default, the MSMQ 3.0 server hosting the queue containing the message to be read requires other domain computers making read requests to establish an encrypted channel, but such a channel cannot be established between non-trusted domains. Thus, remote read requests from cross-forest computers will be rejected. To modify this default behavior and allow the Message Queuing server to accept requests from domain computers that do not establish an encrypted channel, add the
HKLM\SOFTWARE\Microsoft \MSMQ\Parameters\Security\NewRemoteReadServerAllowNoneSecurityClient
registry entry (a DWORD) and set it to 1.
This is form: Reading Messages from Remote Queues.
来源:https://stackoverflow.com/questions/1464797/how-to-receive-message-from-a-private-workgroup-queue