Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 删除单个消息MSMQ_.net_Vb.net_Msmq - Fatal编程技术网

.net 删除单个消息MSMQ

.net 删除单个消息MSMQ,.net,vb.net,msmq,.net,Vb.net,Msmq,是否可以从MSMQ消息队列中删除单个消息?我有一个队列对象,一个我通过窥视得到的消息(对象)和消息的ID,我可以看到删除(或清除)整个队列的方法,但我看不到删除消息的方法,我尝试过在通过窥视找到消息后接收消息,但我得到错误“光标无效” 感谢收到的任何帮助您可以尝试。您是否尝试使用MessageQueue.ReceiveById?使用其中一个接收功能。取决于您的语言/技术(c、com、.net) 对于.net,它将是MessageQueue.ReceiveById方法。或者任何你认为合适的。取决于

是否可以从MSMQ消息队列中删除单个消息?我有一个队列对象,一个我通过窥视得到的消息(对象)和消息的ID,我可以看到删除(或清除)整个队列的方法,但我看不到删除消息的方法,我尝试过在通过窥视找到消息后接收消息,但我得到错误“光标无效”


感谢收到的任何帮助

您可以尝试。

您是否尝试使用
MessageQueue.ReceiveById

使用其中一个接收功能。取决于您的语言/技术(c、com、.net)


对于.net,它将是MessageQueue.ReceiveById方法。或者任何你认为合适的。取决于您要删除的消息(第一个、最后一个,使用光标或id)。

谢谢,但我想通过编程来完成。。我试图通过我在队列上的窥视光标来变得聪明和接受。。。。我工作得很好。。助教
    // Language C#
    // Delete Message Button click handler.
    public void DeleteOneMessage()
    {
        // I created winforms application and added a reference to "System.Messaging"
        // Added one edit box name = queueNameTextBox
        // On Form_Load set queueNameTextBox.Text = @"private$\myQueueName"
        // Connect to the queue on the local computer.
        MessageQueue myQueue = new MessageQueue(queueNameTextBox.Text);

        // Set the formatter to indicate body contains an Order.
        myQueue.Formatter = new BinaryMessageFormatter();

        try
        {
            // Receive and format the message.
            object myMessage = myQueue.Receive();
            MessageBox.Show("One message removed from the queue.");
        }
        catch (MessageQueueException mqe)
        {
            MessageBox.Show(mqe.Message);
        }
        catch (InvalidOperationException e)
        {
            MessageBox.Show(e.Message);
        }
        catch(Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }