zoukankan      html  css  js  c++  java
  • IIS代码管理(1):遍历应用程序池和属性

    下面的代码实现遍历 IIS 6应用程序池的一个方法:

    System.DirectoryServices.DirectoryEntry appPoolRoot = new System.DirectoryServices.DirectoryEntry(@"IIS://localhost/W3SVC/AppPools");
    //得到默认应用程序池的方法可以直接使用 IIS://localhost/W3SVC/AppPools/DefaultAppPool
    System.Collections.IEnumerator AppPoolEnumer = appPoolRoot.Children.GetEnumerator();
    while (AppPoolEnumer.MoveNext())
    {
      System.DirectoryServices.DirectoryEntry EntryPool = (System.DirectoryServices.DirectoryEntry)AppPoolEnumer.Current;
      System.DirectoryServices.PropertyCollection properties = EntryPool.Properties;
      System.Collections.IDictionaryEnumerator propertiesEnumer = properties.GetEnumerator();
      textBox1.Text += "应用程序池名称 = " + EntryPool.Name + System.Environment.NewLine + "____________________________________________" + System.Environment.NewLine;
      while (propertiesEnumer.MoveNext())
      {
        System.DirectoryServices.PropertyValueCollection propertyvalue = (System.DirectoryServices.PropertyValueCollection)propertiesEnumer.Value;
        if (propertyvalue.Count > 1)
        {
          for (int j = 0; j < propertyvalue.Count; j++)
          {
            textBox1.Text += "Name=" + propertiesEnumer.Key.ToString() + "  Value= " + propertyvalue[j] + "--";
          }
        }
        else
        {
          textBox1.Text += "Name=" + propertiesEnumer.Key.ToString() + "  Value= " + propertyvalue[0] + System.Environment.NewLine;
        }
      }

  • 相关阅读:
    word 软换行与硬换行
    正态分布(normal distribution)与偏态分布(skewed distribution)
    hdu1043Eight (经典的八数码)(康托展开+BFS)
    TCP和UDP的区别
    SDUT2608(Alice and Bob)
    The Six Types of Rails Association
    排序算法c语言描述---堆排序
    Jenkins的plugin开发
    SDUTRescue The Princess(数学问题)
    【数据库系列】之存储过程与触发器
  • 原文地址:https://www.cnblogs.com/meiproject/p/908121.html
Copyright © 2011-2022 走看看