博客园  :: 首页  :: 新随笔  :: 联系 :: 管理

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