Doing IISRESET is a bit heavy-duty, I'd think. Why not start out by just
recycling the ASPNET Worker process:
private void KillAspNetProcess()
{
string processName = "aspnet_wp";
System.OperatingSystem os = System.Environment.OSVersion;
//Longhorn and Windows Server 2003 use w3wp.exe
if((os.Version.Major == 5 && os.Version.Minor > 1) || os.Version.Major ==6)
processName = "w3wp";
foreach(Process process in Process.GetProcessesByName(processName))
{
Response.Write("Killing ASP.NET worker process (Process ID:" +
process.Id + ")");
process.Kill();
}
}
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"DataSprings" wrote:
Hi. I am wondering if its possible to restart IIS or my web server
simply from an IIS page? Not sure what code I would need and maybe
impersonation? Any thoughts or ideas anyone?
-Chad