WCF 删除队列

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();
                    }
                }
            }

image

posted on 2014-10-29 11:40  黎木  阅读(282)  评论(0编辑  收藏  举报

导航