How to receive message from a private workgroup queue

ぐ巨炮叔叔 提交于 2020-01-31 18:18:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!