-
C#控制应用程序池
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