原创:C# .Net 获取应该程序池中站点数量,并列举站点和属性

来源:互联网 发布:tq分析软件 编辑:程序博客网 时间:2024/06/03 21:30

txtPath.Text= IIS://Localhost/W3SVC/AppPools/DefaultAppPool;

 

DirectoryEntry pool = new DirectoryEntry(txtPath.Text.Trim());
            lvPoolProties.Items.Clear();
            ////显示属性
            //foreach (string name in pool.Properties.PropertyNames)
            //{
            //    ListViewItem item = new ListViewItem(name+":"+ pool.Properties[name].Value.ToString());
            //    lvPoolProties.Items.Add(item);
            //}

            object[] s = pool.Invoke("EnumAppsInPool", null) as object[];
            MessageBox.Show(s.Length.ToString());

            foreach (object o in s)
            {
                ListViewItem item = new ListViewItem(o.ToString());
                lvPoolProties.Items.Add(item);
            }

原创粉丝点击