回收
public void StartStopRecycleApp(string appName = "项目DLL名称", string method = "Recycle") { using (DirectoryEntry appPool = new DirectoryEntry("IIS://localhost/W3SVC/AppPools")) using (DirectoryEntry findPool = appPool.Children.Find(appName, "IIsApplicationPool")) { findPool.Invoke(method, null); appPool.CommitChanges(); appPool.Close(); } }