VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > temp > C#教程 >
  • C#控制应用程序池

制作者:剑锋冷月 单位:无忧统计网,www.51stat.net
 

using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Management;
namespace AppPoolConsole
{
  class Program
  {
    static void Main(string[] args)
    {
      try
      {
        DirectoryEntry appPools = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
        DirectoryEntry pool = appPools.Children.Find("DefaultAppPool", "IIsApplicationPool");
        pool.Invoke("stop", null);
        //pool.Invoke("start", null);
        pool.CommitChanges();
        pool.Close();
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
      }
      Console.ReadKey();
    }
  }
}

  今天在windows sdk文档里看到的,估计可以完全用代码来控制IIS,再研究...

  http://www.cnblogs.com/flysun/articles/1173764.html



相关教程