I have a transactional private queue on my local machine. If the queue is not authenticated, the message goes into the queue. If I set the queue to be authenticated, it doesn't. The application sending to the queue is running as myself (and I have full control on the queue). Anonymous users also have Send Message permissions on the queue. I'm confused as to what I need to do to send a message to an authenticated queue.
Here is the binding that I am using:
NetMsmqBinding msmq = new NetMsmqBinding(NetMsmqSecurityMode.None);
msmq.MaxReceivedMessageSize = int.MaxValue;
msmq.CloseTimeout = TimeSpan.FromMinutes(3);
msmq.SendTimeout = TimeSpan.FromMinutes(3);
msmq.ReceiveTimeout = TimeSpan.FromMinutes(3);
msmq.ReaderQuotas.MaxDepth = int.MaxValue;
msmq.ReaderQuotas.MaxStringContentLength = int.MaxValue;
msmq.ReaderQuotas.MaxArrayLength = int.MaxValue;
msmq.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
msmq.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
msmq.ExactlyOnce = true;
msmq.Durable = true;
msmq.TimeToLive = TimeSpan.FromHours(1);
Ideally, I would like to have everyone (including unrecognized users) be able to send messages, but limit who can peek and receive messages. I'm not sure if this is possible.
So, the first question: How can I get a message into an authenticated queue?
It looks like I need to turn transport security on with msmqAuthenticationMode
of WindowsDomain
. However, when I do, I get the following error:
Binding validation failed because the binding's MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory integration disabled. The channel factory or service host cannot be opened.
Looks like my MSMQ is installed in Workgroup mode, not Directory mode. How do I fix that? When I remove MSMQ and then add it back (with all features), it's still not in Directory mode. I am on Win7.
MSMQ has to be installed in Directory mode, and you have to set msmq.Security.Mode
to Transport
to provide the WindowsDomain credentials. To get to Directory mode, you need to reinstall MSMQ - but make sure to remove the msmq object on your machine before reinstalling.