C# 清理消息管道的消息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Messaging;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{

class Program
{
static void Main(string[] args)
{
//
var qs = MessageQueue.GetPrivateQueuesByMachine("isc-2065");// 机器名
MessageQueue queue = new MessageQueue("FormatName:DIRECT=OS:isc-2065\\private$\\spc/msmqyahooservice.svc");//对应的消息管道
// Delete all messages from the queue.

queue.Purge();
}

}
}

posted @ 2016-04-15 09:06  公众号python学习开发  阅读(388)  评论(0编辑  收藏  举报