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

  • 相关阅读:
    Learning Rhino 1
    Learning Rhino 2
    JavaScript tips and tricks 5
    Observer pattern in JavaScript
    敏捷开发的原则
    什么是CLS?
    整理一些小东西,留个备份
    一个调查结果(在下一个版本的VS/C#中你想要什么?)
    如何知道一个类都实现了哪些接口和从那个类继承
    敏捷软件开发主要包括哪些方法
  • 原文地址:https://www.cnblogs.com/meiproject/p/908121.html
Copyright © 2011-2022 走看看