I created a private queue on a development server that is transactional and am trying to push a message to it via C#:
using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
//AppSetting has: FormatName:DIRECT=OS:.\private$\queue_name
sampleQueue = new MessageQueue(System.Configuration.ConfigurationManager.AppSettings["q"]);
var msg = new SampleMessage { CreateDate = DateTime.Now, Body = Guid.NewGuid().ToString() };
var mess = new Message(msg);
mess.UseDeadLetterQueue = true;
mess.Recoverable = true;
sampleQueue.Send(mess, MessageQueueTransactionType.Single);
scope.Complete();
}
The SampleMessage
class just exposes a CreateDate
and Body
set of properties - completely generic, as this is just a sample.
When running the code in my local environment (Windows 10 Pro), I can put a message in the queue with the above code successfully. Similarly, if I run the same code on the development server (Windows Server 2016), the message shows up as expected.
My issue comes in with trying to put a message from my local system on to the remote queue (changing the .
to the FQDN of the server, which has an entry in my HOSTS file), which kicks back The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.
if I try to access any of the properties from sampleQueue
(above - example property would be MachineName
), but if I don't access any properties the message just fails to deliver with no indication as to why and no errors thrown. I enabled dead-letter on the message (above), but neither transactional nor non-transactional show any failed messages, so I'm at a loss. I've also tried FormatName:DIRECT=OS
, FormatName:DIRECT=TCP
and checked all of the capitalization to be sure it's right with no luck. Also, I ensured Disable un-authenticated RPC calls
is not checked and the Windows Firewall has been turned off on both machines.
The production environment will not be associated with an Active Directory domain, so this is all workgroup-based MSMQ. Anonymous Logon has been enabled, queue is definitely transactional and since local works, I'm stumped.
Interestingly enough, when I try to send to the remote queue I see where that pops up in Outgoing Queues. I looked at it, see that it shows a state of Connected
, has 0 messages, 0 unacknowledged messages and 0 unprocessed messages. The IP it shows under Next Hop(s)
is correct, so name resolution is also working.
Any suggestions? I'm trying to avoid requiring developers to create MSMQ queues on their local machines, but right now that's the only option I can see if I can't get this to work.
Update
Based on a comment below, I created a non-transactional queue called test_queue
on the remote server and attempted to send a message to it. It arrived at the destination server, but went into Dead-Letter messages, with a class of The destination queue does not exist
listed. The queue name in my config file shows FormatName:DIRECT=OS:remote-server-name\private$\test_queue
and it's definitely a private queue, so I'm really confused since the queue is definitely there.