2

I'm using C# on Windows Server 2008, and I want to receive a message from a public transactional queue on another machine in the same domain. The error looks like this:

System.Messaging.MessageQueueException: Cannot import the transaction.
   at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
   at System.Messaging.MessageQueue.Receive(TimeSpan timeout, MessageQueueTransactionType transactionType)
   at JobManagerLib.JobProcessor.Process(Action waitForNewMessageCallback) in C:\Dev\OtherProjects\POC\WindowsService\JobManagerSample\JobManagerLib\JobProcessor.cs:line 132

I've tried DTCPing, which succeeds in one direction but fails in the other. Here is the pertinent part of the log:

++++++++++++hosts      ++++++++++++
127.0.0.1       localhost
::1             localhost

08-20, 15:47:22.739-->Error(0x424) at clutil.cpp @256
08-20, 15:47:22.739-->-->OpenCluster
08-20, 15:47:22.739-->-->1060(The specified service does not exist as an installed service.)
++++++++++++++++++++++++++++++++++++++++++++++
     DTCping 1.9 Report for DEV-MSMQ2  
++++++++++++++++++++++++++++++++++++++++++++++
RPC server is ready
++++++++++++Validating Remote Computer Name++++++++++++
08-20, 15:47:26.207-->Start DTC connection test
Name Resolution:
    dev-msmq1-->192.168.22.11-->Dev-msmq1
08-20, 15:47:26.222-->Start RPC test (DEV-MSMQ2-->dev-msmq1)
RPC test failed

Does anybody have any idea why this might be failing? The Windows Firewall has been opened for MSDTC. It's hard to find much info about Windows 2008 and MSMQ.

EDIT: The queue names are FormatName:DIRECT=OS:dev-msmq1\getmap, and FormatName:DIRECT=OS:dev-msmq1\logevent. They are public, transactional queues, and Everyone has peek/receive permission on them. The pertinent part of my code is as follows:

using (TransactionScope tx = new TransactionScope(TransactionScopeOption.RequiresNew))
{
    using (var queue = new MessageQueue(QueueName))
    {
        queue.Formatter = new XmlMessageFormatter(new string[] { _targetParameterType });
        var message = queue.Receive(TimeOut, MessageQueueTransactionType.Automatic);
        string messageId = message.Label;

...
    }
}

Thanks

3
  • Maybe post your code or your queue configuration. MSMQ can be picky on the formatting of the queue name.
    – Web
    Aug 20, 2009 at 20:08
  • But what the are the actual names? (technet.microsoft.com/en-us/library/cc778392(WS.10).aspx). Though I do think it relates to the transactions. (MSDTC). Never used that though. Sorry.
    – Noon Silk
    Aug 21, 2009 at 2:39
  • Sorry...queue names that are being used here are FormatName:DIRECT=OS:dev-msmq1\SendEmail and FormatName:DIRECT=OS:dev-msmq1\LogEvent. Aug 21, 2009 at 17:06

3 Answers 3

1

So I did find a solution: abandon the whole thing altogether and switch to using WCF and the net.Msmq binding. Now the queue communication is working fine.

0

Make sure, both machine's clocks are in sync. I seen this before where authentication will fail because the server and the client are off time by a minute. This will happen even if the queues are public and have permissions on everyone.

0

Just for completeness, allowing only MSDTC and MSMQ through the firewall is not enough when running IPv4:

You need to let ICMP traffic through the firewall as well (IPv6 can resolve host names regardless of the firewall, but your DTCPIng log indicates you are running IPv4).

I have struggled with the same error you see in DTCPing, and in my case it turned out to be triggered by the firewall blocking the ICMP traffic.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.