public override void Uninstall(System.Collections.IDictionary savedState) { if (!_isServiceInstalled) { Console.WriteLine("\r\nSkipping uninstall: '{0}' service is not installed.", _serviceInstaller.ServiceName); Installers.Clear(); } base.Uninstall(savedState); }
private void CreateInstallers() { Installers.Clear(); foreach (string categoryName in categoryNames) { PerformanceCounterInstaller installer = new PerformanceCounterInstaller(); installer.CategoryName = categoryName; installer.CategoryHelp = Resources.PerformanceCounterCategoryHelp; installer.CategoryType = PerformanceCounterCategoryType.MultiInstance; installer.Counters.Add(GetNumberOfCallsCreationData()); installer.Counters.Add(GetCallsPerSecondCreationData()); installer.Counters.Add(GetNumberOfExceptionsCreationData()); installer.Counters.Add(GetExceptionsPerSecondCreationData()); installer.Counters.Add(GetAverageCallDurationCreationData()); installer.Counters.Add(GetAverageCallDurationBaseCreationData()); Installers.Add(installer); } }
private void AcsServiceInit() { String path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); String executable = Path.GetFullPath(Assembly.GetExecutingAssembly().Location); Console.WriteLine("Path = {0}", path); Console.WriteLine("Executable = {0}", executable); String configFilePath = String.Format("{0}.config", executable); using (AppConfig.Change(configFilePath)) { Installers.Clear(); WorkloadContainerProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller(); WorkloadContainerServiceInstaller = new System.ServiceProcess.ServiceInstaller(); // Default to LocalService account. Admins can reset to domain account after install // if needed. WorkloadContainerProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalService; WorkloadContainerProcessInstaller.Password = null; WorkloadContainerProcessInstaller.Username = null; Console.WriteLine("Parsing config file"); foreach (String key in ConfigurationManager.AppSettings.AllKeys) { Console.WriteLine("{0} = '{1}'", key, ConfigurationManager.AppSettings[key]); } WorkloadContainerServiceInstaller.Description = Helpers.GetSetting("ServiceDescription") ?? WorkloadContainerServiceInstaller.Description; WorkloadContainerServiceInstaller.DisplayName = Helpers.GetSetting("ServiceDisplayName") ?? WorkloadContainerServiceInstaller.DisplayName; WorkloadContainerServiceInstaller.ServiceName = Helpers.GetSetting("ServiceName") ?? WorkloadContainerServiceInstaller.ServiceName; Installers.AddRange(new System.Configuration.Install.Installer[] { WorkloadContainerProcessInstaller, WorkloadContainerServiceInstaller }); } }
public ProjectInstaller() { InitializeComponent(); Installers.Clear(); ServiceInstaller serviceInstaller = new ServiceInstaller(); serviceInstaller.StartType = ServiceStartMode.Automatic; serviceInstaller.ServiceName = Program.SVC_NAME; serviceInstaller.DisplayName = Program.SVC_DSNAME; serviceInstaller.Description = Program.SVC_DESC; serviceInstaller.ServicesDependedOn = new string[] { "MSMQ" }; Installers.Add(serviceInstaller); ServiceProcessInstaller processInstaller = new ServiceProcessInstaller(); processInstaller.Account = ServiceAccount.LocalSystem; processInstaller.Password = null; processInstaller.Username = null; Installers.Add(processInstaller); }