0

I have some code that sends a message to a remote queue.

var queue = new MessageQueue(queueName);
var message = new Message(queueMessage, new BinaryMessageFormatter());
queue.Send(message);

I've tried setting the queue using IP and hostname, it makes no difference:

FormatName:Direct=TCP:1.2.3.4\Private$\my.queue
FormatName:Direct=OS:servername\Private$\my.queue

The messages appear in the outgoing messages queue (if I pause it)

When unpaused they're sent to the server.

There is a private queue set up on the server. There is nothing running that will take messages off the queue.

However, messages never appear in the queue on the remote machine. I don't know how to debug this problem. The queue is a private non-transactional queue.

Creating a local private queue and sending messages to it works fine.

Are there some logs or something I can look at to see what might be happening?

The status in outgoing messages shows state as 'connected' so there is no connection issue.

Edit:

The only logging I can find is in event viewer > microsoft > windows > msmq which has an entry that simply says "Message came over network" whenever I send a message via MSMQ. It has no other information.

NibblyPig
  • 51,118
  • 72
  • 200
  • 356
  • A IIS application has very little access to the filesystem. I would use a Network drive to send files and then have IIS read files from the Network Driver. – jdweng Feb 11 '20 at 15:15
  • I'm not sending files, I'm sending serialized objects – NibblyPig Feb 11 '20 at 15:16
  • I'd try a couple of things: First, is your Queue transactional? If so, are you setting the appropriate flag in your calling code? Next, on the webserver, in Computer Management->Services and Applications->Message Queueing->Message Queues->Outgoing Queues do you see any connections to the MSMQ server? Are there any errors? – Peter Mourfield Feb 11 '20 at 15:20
  • Queue is not transactional, no errors, connection shows 'connected' in outgoing queues. Also going to edit question to add that I can see "Message came over network" in event log – NibblyPig Feb 11 '20 at 15:21
  • Serialization output is a file. – jdweng Feb 11 '20 at 15:42

1 Answers1

2

Solved, I added this:

message.UseDeadLetterQueue = true;

This made the server put it into the dead letter queue under System Queues > Dead-letter messages

Once this happened I could see my message and clicking it, it said 'Access Denied' under the 'Class' heading.

A quick google revealed that even though I had granted Everyone full access permissions to the queue, it was necessary to add Anonymous Logon and give that full access too in the security tab of the queue.

NibblyPig
  • 51,118
  • 72
  • 200
  • 356