Using Multicast Queues in System.Messaging and MSMQ 3.0

I am trying to use MessageQueues to notify users of the application of data changes using the Multicast function, but I can not get it to work: the workstation that sends the message receives it, but none of the other working workstations looks to catch the sent message.

Messages are sent as follows:

Dim sendQueue As New Messaging.MessageQueue("FormatName:MULTICAST=234.1.1.1:8001") Dim message As New Messaging.Message("message body...") sendQueue.Send(message) 

And having received them:

 Dim receiveQueue As New Messaging.MessageQueue(".\private$\myQ") receiveQueue.MulticastAddress = "234.1.1.1:8001" receiveQueue.BeginReceive() AddHandler receiveQueue.ReceiveCompleted, Sub(sender As Object, e As Messaging.ReceiveCompletedEventArgs) ' ... handle message receiveQueue.BeginReceive() End Sub 

So, I obviously missed something, and I cannot find good multicast resources with MSMQ 3.0 in .NET.

In addition, it is unclear whether to use the local queue for one workstation or one remote queue on the server for multicasting. And does the receiving method use multicast messages from the queue?

Any help, hints, tips, suggestions, anything ... would be greatly appreciated.

On the one hand, all workstations are on the same subnet, and all have MSMQ 3.0 installed.

The last word

Ok, thank you laptop for your help. The problem was related to the permissions that I discovered while testing your solution using COM objects:

Although the Queue Properties dialog box says, permissions are NOT completely ignored in unauthenticated queues, at least when using multicast . If you want your queue to receive multicast messages, it must grant ANONYMOUS_LOGON the right to send messages. Otherwise, multicast messages are simply discarded without notification in the event logs or in general (if I did not miss something).

On Win7 stations (XP stations seem to be working well, which pointed to a real problem), queues created using the code do not have these permissions and, therefore, must be set manually after creating the queue:

 Dim msgQ = Messaging.MessageQueue.Create(queueName) msgQ.SetPermissions("ANONYMOUS LOGON", Messaging.MessageQueueAccessRights.WriteMessage) 

Inside, MSMQ seems to be using this account to record multicast messages in a queue without authentication.

+7
source share
1 answer

Could you create an MSMQDestination class and assign it a multicast format, set a message label, and complete the send task using the MSMQMessage class

 Dim dest As New MSMQDestination dest.FormatName = "MULTICAST=234.1.1.1:8001" Dim message As MSMQMessage message.label ="Test Message" message.Send DestinationQueue:=dest 

UPDATE OF COMPLETION OF THE WORD Now I am glad that you helped. for your problem on another machine, this is an increase in security to prevent a denial of service attack. msmq default msmq resolution changed in msmq 4.0

+2
source

All Articles