MSMQ 4.0 Access private queue from a Domain Devmachine a development Docker Container

Viewed 258

my dev machine is in a Domain and i have a docker container with windows server running in and msmq installed. I want to access a private queue but this is not working from my dev machine. In the docker container i can access the queue.

I followed all the instructions i found in the web.

Docker config:

FROM mcr.microsoft.com/windows/servercore:1809
RUN powershell -Command Enable-WindowsOptionalFeature -Online -FeatureName MSMQ-Server -All

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR C:\utils
RUN net user guest /active:yes
RUN Set-DtcNetworkSetting -DtcName "local" -Confirm:$false -InboundTransactionsEnabled 1 -OutboundTransactionsEnabled 1 -RemoteClientAccessEnabled 1 -RemoteAdministrationAccessEnabled 1 -XATransactionsEnabled 1 -LUTransactionsEnabled 1 -AuthenticationLevel NoAuth
RUN Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\MSMQ\Parameters\Security\ -Name AllowNonauthenticatedRPC -Value 1 -Type 'DWORD'
RUN Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\MSMQ\Parameters\Security\ -Name NewRemoteReadServerAllowNoneSecurityClient -Value 1 -Type 'DWORD'
RUN Set-ItemProperty -Path HKLM:\System\CurrentControlSet\Control\Lsa\ -Name EveryoneIncludesAnonymous -Value 1 -Type 'DWORD'
ENTRYPOINT ping -t localhost

Queues are created with Powershell as a private queue and access is configured

New-MsmqQueue -Name "OrderQueue"
Get-MsmqQueue | Set-MsmqQueueAcl -UserName "NT AUTHORITY\ANONYMOUS LOGON" -Allow "DeleteMessage, PeekMessage, ReceiveMessage, WriteMessage, DeleteJournalMessage, ReceiveJournalMessage,SetQueueProperties, GetQueueProperties, DeleteQueue, GetQueuePermissions, GenericWrite, GenericRead,ChangeQueuePermissions, TakeQueueOwnership, FullControl"
Get-MsmqQueue | Set-MsmqQueueAcl -UserName "Everyone" -Allow "DeleteMessage, PeekMessage, ReceiveMessage, WriteMessage, DeleteJournalMessage, ReceiveJournalMessage,SetQueueProperties, GetQueueProperties, DeleteQueue, GetQueuePermissions, GenericWrite, GenericRead,ChangeQueuePermissions, TakeQueueOwnership, FullControl"

Code(Powershell script) on my dev machine to access the queue:

[System.Reflection.Assembly]::LoadWithPartialName("System.Messaging")
$queuePath = 'FormatName:DIRECT=TCP:<IP of docker container>\private$\OrderQueue'
$queue = New-Object System.Messaging.MessageQueue $queuePath
$queue.GetAllMessages()

Any ideas why the exception is coming: enter image description here

EDIT: What i want to to: from my host machine (where docker docker is installed) i want to read messages from a queue from docker container where msmq is running on. With the provided powershell script you can connect to an external msmq queue. The ping command in the docker file is only a trick from me that the container is not stopping and running till i stop it. Is there another way to keep the container running ?

0 Answers
Related