Recycle IIS6.0 application pools from code

Works with IIS6.0 Windows Server 2003 SP1…
 

public static void Recycle(string host, string poolname)

{

using

(DirectoryEntry apppool = new DirectoryEntry(string.Format(“IIS://{0}/w3svc/apppools/{1}”, host, poolname)))

{

apppool.Invoke(“Recycle”);

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *