Creating MSMQ programmatically using .NET

runs on a Win 2008 R2 machine.

As part of automating the installation process of the application, I created a small command-line utility that, when called, creates MQ. since my deployment takes place in a workgroup environment, I set the created permissions for the queue so that everyone and anonymous users have full control over the queue.

my code is

Try
    Dim Q As MessageQueue = MessageQueue.Create(QueueName)
    Console.WriteLine("Queue created successfully")

    ' Create an AccessControlList.
    Dim list As New AccessControlList()

    'Add the AccessControlEntry to the AccessControlList.
    list.Add(New AccessControlEntry(New Trustee("Everyone"), GenericAccessRights.All, StandardAccessRights.All, AccessControlEntryType.Allow))
    'Add the AccessControlEntry to the AccessControlList.
    list.Add(New AccessControlEntry(New Trustee("ANONYMOUS LOGON"), GenericAccessRights.All, StandardAccessRights.All, AccessControlEntryType.Allow))

    ' Apply the AccessControlList to the queue.
      Q.SetPermissions(list)

Catch ex As Exception
    Console.WriteLine(String.Format("Unable to create queue {1}. {0}", ex, QueueName))

End Try

, ".\Private $\QueueName", , , ( ). , , . ( ) , . , , , .

, - : c:\Windows\Sysnative\msmq\storage\lqs\ ,

= 010007806800000084000000000000001400000002005400030000000000140024001f100101000000000001000000000000140004001f10010100000000000507000000000024003f000f0001050000000000051500000097fd4a8271ec5457708be3d5f401000001050000000000051500000097fd4a8271ec5457708be3d5f401000001050000000000051500000097fd4a8271ec5457708be3d501020000

:

= 01000780680000008400000000000000140000000200540003000000000024003f000f0001050000000000051500000097fd4a8271ec5457708be3d5f4010000000014003f000f00010100000000000507000000000014003f000f0001010000000000010000000001050000000000051500000097fd4a8271ec5457708be3d5f401000001050000000000051500000097fd4a8271ec5457708be3d501020000

, , "" , , 2- "" .

?

PS , MSFT, MS, http://social.msdn.microsoft.com/Forums/en-US/msmq/thread/2f87fe8a. -c452-432a-815d-05eeaf455514/

+3
1

System.Messaging.MessageQueueInstaller? installutil. , ( , , , ..), . , .

+1

Source: https://habr.com/ru/post/1788992/


All Articles