If you have a specific web site name, you can use the WMI to stop and start that web site. If it's IIS as a whole, I'm sure there is something in the IIS WMI provider for doing this. Here I'm using WebAdministration to manage a web site under IIS, but there's also MicrosoftIISV2. Google for WmiExplorer, there are some good ones out there.
var connOptions = new ConnectionOptions();
connOptions.Authentication = AuthenticationLevel.PacketPrivacy;
// if you want to connect as someone other than logged in user
//connOptions.Username = username;
//connOptions.Password = password;
var scope = new ManagementScope("\\localhost\WebAdministration", connOptions);
WqlObjectQuery query = new WqlObjectQuery(`enter code here`string.Format("SELECT * FROM Site WHERE Name = '{0}'", "Default Web Site"));
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query))
{
foreach (ManagementObject site in searcher.Get())
{
ManagementBaseObject inParams = site.GetMethodParameters("Stop");
site.InvokeMethod("Stop", inParams, null);
ManagementBaseObject inParams2 = site.GetMethodParameters("Start");
site.InvokeMethod("Start", inParams2, null);
}
}