views:

999

answers:

2

I have a windows service that needs to access a message queue (MSMQ).

The queue itself is created using a MessageQueueInstaller component that automatically generates the install code. I then deploy this using a standard setup project.

The service is installed in the same way, using the same setup project.

When I start the service it stops straight away, and I get the following exception in my code

Access to Message Queuing system is denied

I've tried both LocalService and NetworkService.

Do I need the installer to change the permissions required for the queue or do I need to change the permissions that the service has?

How should I modify the setup project to make this change?

A: 

One of the reasons for this behaviour is caused because the MSMQ is installed in Networkgroup mode.

Try using an Account from the domain that has Admin rights in the computer. (that's the only thing that is working for me)

You could also Grand righst to MQ for this user. open computer manager and do it that way.

Chris Jones
This sounds like work that the person deploying to software would need to do. Can I get the setup project to do any of this?
tpower
the only way i know how to do this is manually. we use a product from scribesoft. Even with thier installer i had to set this up manually.
Chris Jones
+1  A: 

You should change the permissions on the queue. Those users don't have access to the queue by default.

Igal Serban
For those who might care, I did the following: `messageQueue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);`
Pure.Krome