public void UninstallWebApp(string applicationInstanceName) { try { string cmd = String.Format("stop apppool {0}", applicationInstanceName); ExecAppcmd(cmd, 5, twoSeconds); ushort i = 0; ApplicationInstanceStatus status = ApplicationInstanceStatus.Unknown; while (ApplicationInstanceStatus.Stopped != status && i < 5) { status = GetApplicationStatus(applicationInstanceName); ++i; } cmd = String.Format("delete apppool {0}", applicationInstanceName); ExecAppcmd(cmd, 5, twoSeconds); cmd = String.Format("delete site {0}", applicationInstanceName); ExecAppcmd(cmd, 5, twoSeconds); } catch (Exception ex) { log.Error(ex); } try { firewallService.Close(applicationInstanceName); } catch (Exception ex) { log.Error(ex); } }
public override void StopService() { firewallService.Close(Resources.MonitoringWinService_ServiceName); base.StopService(); }