1

I am new to MSMQ and suspect I either have my queues configured wrong or programmatically (is that a word?)causing them to get hung up.

When everything starts I can send one message and that works wonderfully. I can see (ie via mmc on that machine) the message in the remote machine queue. I then go to access it and I get my UnsupportedFormatNameOperation error. If I try to send another message I get the same error in the send method that just worked a few seconds earlier.

What is even more frustrating is that my catch is NOT picking up the exception so I was unaware and looking elsewhere (read wasting time) till I explored the queue object in the debugger.

Now if I reset the Message Service on remote I lose my message in the queue and still get the same error. If I reboot same result.

On local (dev machine) if I reset the Message Service I still get the error. If I reboot something gets recycled and I can send exactly one message again.

Further after reboot of dev machine and exploring the queue object on the first run I find that I am getting the error the FIRST time around but it still sends the message.

So I am clearly doing something wrong but clueless as to what.

Here is my send code:

private void SendLoginMessage(...bunch of parms)
        {
            //hardcoded path? yup!!
            MessageQueue msmq = new MessageQueue(@"FormatName:DIRECT=OS:W2K8R2_SQL2K8R2\private$\best_simulator");

            try
            {
                LoginStatusMessage LgnMsg = new LoginStatusMessage()
                {
                    ...assign parms to my 
                };
                msmq.Send(LgnMsg);
            }
            catch (MessageQueueException msmqex)
            {
                MessageBox.Show(msmqex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                msmq.Close();
            }
        }
4

1 回答 1

1

UnsupportedFormatNameOperation的描述是

不支持指定格式名称的请求操作。

当指定格式名称不支持请求的操作时,消息队列会返回此错误。操作包括尝试通过指定直接格式名称来打开队列以接收消息。

所以我猜你的问题可能出在你的接收代码上。

于 2013-02-23T23:50:44.203 回答