WCF 删除队列

时间:2023-12-19 22:59:02
Configuration config = ConfigurationManager.OpenExeConfiguration
(ConfigurationUserLevel.None);
ServiceModelSectionGroup group=ServiceModelSectionGroup.GetSectionGroup(config);
foreach(ChannelEndpointElement endPoint in group.Client.Endpoints )
{
if (endPoint.Binding == "netMsmqBinding")
{
string queuename = GetQueueFromUri(endPoint.Address);
if (MessageQueue.Exists(queuename) == false)
{
MessageQueue queue = new MessageQueue(queuename);
queue.Purge();
}
}
}

WCF 删除队列