"Access to Message Queuing system is denied" exception in console application

5.4k Views Asked by At

I have an application that can run both as windows service or stand-alone console. It is deployed remotely, on my client's servers. When I remote desktop into the server, I use the same domain account that is used to run the windows service configuration of my application. Therefore, running the application as windows service or console is done absolutely under the same credentials. Or is it? The problem is that my console throws the "Access to Message Queuing system is denied" exception while the windows service doesn't have any issues with this. All the functionality of the application that accesses the MSMQ system is encapsulated into a .dll that is used by both the windows service and the console, so again, there should be no difference.

Any ideas as to what should I change?

2

There are 2 best solutions below

0
On

The user under which the service/console is executing should have access to MSMQ. Please check if this is the case or not in your instance.

0
On

I made a Windows Service that interact with MSMQ (a stupid data exchange application with no requirement regarding security).

I had to disable un-authenticated RPC calls using the Message Queuing properties pane in Computer management to make it work. Otherwise it throws System.Messaging.MessageQueueException (0x80004005): Access to Message Queuing system is denied.

Also the service run under Local System (which I remember is by default)

enter image description here