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

  • 相关阅读:
    undefined与null的区别
    js 合并多个对象 Object.assign
    No 'Access-Control-Allow-Origin' Ajax跨域访问解决方案
    CSS3的REM设置字体大小
    延迟运行方法
    如何用 SQL Tuning Advisor (STA) 优化SQL语句
    Oracle数据库查找持有锁的SQL语句,而不是请求锁的SQL语句(原创)
    Oracle记录登录失败的触发器
    11g ASM新特性
    闪回事务(Flashback Transaction)
  • 原文地址:https://www.cnblogs.com/meiproject/p/908121.html
Copyright © 2011-2022 走看看