Deltax76
Deltax76

Reputation: 14263

How to access a private MSMQ queue created by NETWORK SERVICE account?

My application consists of two part: a web service, which sends queues to a private MSMQ queue, and a Windows service, which takes queues and inserts them to database. In my development machine, everything's fine, but when I deploy them to the server, a permission issue was risen:

I tried to add permissions for administrator account, but failed with error "Access is denied". I even cannot delete these queues.

How can I fix this? Thank you very much

Upvotes: 4

Views: 3995

Answers (2)

Rikin Patel
Rikin Patel

Reputation: 9383

Add NETWORK SERVICE and Administrators rights both. at the time of Create queue.

and if you want to delete queue then follow this step...

https://stackoverflow.com/a/11430249/672891

Upvotes: 1

Martin Liversage
Martin Liversage

Reputation: 106796

When the webservice creates the queue it should make sure that it has appropriate access rights. If you are using .NET you can use the MessageQueue.SetPermissions method to modify the permissions of the queue after it has been created.

This C# code will create a new message queue and give the local Administrators group full control over it:

var messageQueue = MessageQueue.Create(path, true);
messageQueue.SetPermissions(
  "Administrators",
  MessageQueueAccessRights.FullControl
);

Upvotes: 5

Related Questions