HTTP Error: 400 when sending msmq message over http

Posted by dontera on Stack Overflow See other posts from Stack Overflow or by dontera
Published on 2010-03-31T17:32:43Z Indexed on 2010/04/01 3:13 UTC
Read the original article Hit count: 471

Filed under:
|

I am developing a solution which will utilize msmq to transmit data between two machines. Due to the seperation of said machines, we need to use HTTP transport for the messages.

In my test environment I am using a Windows 7 x64 development machine, which is attempting to send messages using a homebrew app to any of several test machines I have control over.

All machines are either windows server 2003 or server 2008 with msmq and msmq http support installed.

For any test destination, I can use the following queue path name with success:

FORMATNAME:DIRECT=TCP:[machine_name_or_ip]\private$\test_queue

But for any test destination, the following always fails

FORMATNAME:DIRECT=HTTP://[machine_name_or_ip]/msmq/private$/test_queue

I have used all permutations of machine names/ips available. I have created mappings using the method described at this blog post. All result in the same HTTP Error: 400.

The following is the code used to send messages:

       MessageQueue mq = new MessageQueue(queuepath);

        System.Messaging.Message msg = new System.Messaging.Message
                                           {                                                       
                                               Priority = MessagePriority.Normal,
                                               Formatter = new XmlMessageFormatter(),
                                               Label = "test"
                                           };
        msg.Body = txtMessageBody.Text;
        msg.UseDeadLetterQueue = true;
        msg.UseJournalQueue = true;
        msg.AcknowledgeType = AcknowledgeTypes.FullReachQueue | AcknowledgeTypes.FullReceive; 
        msg.AdministrationQueue = new MessageQueue(@".\private$\Ack");

        if (SendTransactional)
            mq.Send(msg, MessageQueueTransactionType.Single);
        else
            mq.Send(msg);

Additional Information: in the IIS logs on the destination machines I can see each message I send being recorded as a POST with a status code of 200.

I am open to any suggestions.

© Stack Overflow or respective owner

Related posts about msmq

Related posts about http