public bool Install(ServiceConfiguration configuration)
        {
            if (configuration.Dependencies != null)
            {
                var validationResults = serviceValidator.ValidateServices(configuration.Dependencies);

                var invalidCount = validationResults.Count(vr => !vr.Exists);

                if (invalidCount > 0)
                {
                    //Do something about missing dependencies
                }
            }

            var serviceSettings = configuration.ServiceSettings;

            var installer = new ServiceInstaller
                {
                    Description = serviceSettings.Description,
                    ServicesDependedOn = configuration.Dependencies,
                    DisplayName = serviceSettings.DisplayName,
                    ServiceName = serviceSettings.ServiceName,
                };

            SetupServiceStartup(installer, configuration.StartupType);

            return true;
        }
        public BackgroundServiceInstaller()
        {
            var process = new ServiceProcessInstaller
            {
                Account = ServiceAccount.LocalSystem
            };

            var serviceAdmin = new ServiceInstaller
            {
                StartType = ServiceStartMode.Manual,
                ServiceName = BackgroundService.Name,
                DisplayName = BackgroundService.DisplayName,

                DelayedAutoStart = true,

                Description = "The windows background service for Media Browser Server.",

                // Will ensure the network is available
                ServicesDependedOn = new[] { "LanmanServer" }
            };

            // Microsoft didn't add the ability to add a
            // description for the services we are going to install
            // To work around this we'll have to add the
            // information directly to the registry but I'll leave
            // this exercise for later.

            // now just add the installers that we created to our
            // parents container, the documentation
            // states that there is not any order that you need to
            // worry about here but I'll still
            // go ahead and add them in the order that makes sense.
            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
Beispiel #3
0
        /// <summary>
        /// This method creates the service and service process installer based on the information passed in the ServiceInstallerAttribute class.
        /// </summary>
        protected virtual void InitializeService(ServiceInstallerAttribute servAttr)
        {
            ServiceProcessInstaller serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new System.ServiceProcess.ServiceInstaller();

            // 
            // serviceInstaller
            // 
            serviceInstaller.DisplayName = servAttr.DisplayName;
            serviceInstaller.ServiceName = servAttr.ServiceName;
            serviceInstaller.Description = servAttr.Description;
            serviceInstaller.StartType = servAttr.StartMode;

            //this.serviceInstaller.DisplayName = "Budubu Analysis Engine";
            //this.serviceInstaller.ServiceName = "BudubuAnalysisEngine";
            //this.serviceInstaller.Description = "This is the Snagsta.com analysis service.";
            //this.serviceInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;

            // 
            // serviceProcessInstaller
            // 
            serviceProcessInstaller.Account = servAttr.Account;
            serviceProcessInstaller.Username = servAttr.Username;
            serviceProcessInstaller.Password = servAttr.Password;

            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(
                new System.Configuration.Install.Installer[] { serviceProcessInstaller, serviceInstaller }
                );

        }
 /// <summary>
 /// Initalizes the service installer.
 /// </summary>
 private void InitalizeServiceInstaller()
 {
     this.zentityServiceProcessInstaller = new ServiceProcessInstaller();
     this.zentityServiceInstaller        = new  ServiceInstaller();
     //
     // zentityServiceProcessInstaller
     //
     this.zentityServiceProcessInstaller.Account  = ServiceAccount.User;
     this.zentityServiceProcessInstaller.Password = null;
     this.zentityServiceProcessInstaller.Username = null;
     //
     // zentityServiceInstaller
     //
     this.zentityServiceInstaller.ServiceName = "Zentity Notification Service";
     this.zentityServiceInstaller.Description = "Zentity Notification Service is responsible for publishing Pivot collections from Zentity when there are updates to the database.";
     this.zentityServiceInstaller.StartType   = ServiceStartMode.Automatic;
     //
     // Project Installer
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[]
     {
         this.zentityServiceProcessInstaller,
         this.zentityServiceInstaller
     });
 }
Beispiel #5
0
 public TfsDeployerInstaller()
 {
     _processInstaller = new ServiceProcessInstaller();
     this._eventLogInstaller = new System.Diagnostics.EventLogInstaller();
     this._tfsIntegratorInstaller = new System.ServiceProcess.ServiceInstaller();
     //
     // _eventLogInstaller
     //
     this._eventLogInstaller.CategoryCount = 0;
     this._eventLogInstaller.CategoryResourceFile = null;
     this._eventLogInstaller.Log = "Application";
     this._eventLogInstaller.MessageResourceFile = null;
     this._eventLogInstaller.ParameterResourceFile = null;
     this._eventLogInstaller.Source = "Readify.TfsDeployer";
     //
     // _tfsIntegratorInstaller
     //
     this._tfsIntegratorInstaller.DisplayName = "TFS Deployer";
     this._tfsIntegratorInstaller.ServiceName = "TfsDeployer";
     this._tfsIntegratorInstaller.Description = "Performs Deployment for Team Foundation Server";
     this._tfsIntegratorInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
     _processInstaller.Account = ServiceAccount.LocalSystem;
     this.Installers.Add(_eventLogInstaller);
     this.Installers.Add(_tfsIntegratorInstaller);
     this.Installers.Add(_processInstaller);
 }
Beispiel #6
0
        public Installer1()
        {
            InitializeComponent();

            this.ServiceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
            //
            // ServiceProcessInstaller1
            //
            this.ServiceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem; // LocalSystem
            this.ServiceProcessInstaller1.Password = null;
            this.ServiceProcessInstaller1.Username = null;
            //
            // serviceInstaller1
            //
            this.serviceInstaller1.DisplayName = "dp2 Router Service";
            this.serviceInstaller1.ServiceName = "dp2RouterService";
            this.serviceInstaller1.Description = "dp2 网关服务器,数字平台北京软件有限责任公司 http://dp2003.com";
            this.serviceInstaller1.StartType   = ServiceStartMode.Automatic;
            //
            // ProjectInstaller
            //
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.ServiceProcessInstaller1,
                this.serviceInstaller1
            });

            this.serviceInstaller1.Committed += new InstallEventHandler(serviceInstaller1_Committed);
        }
        private void Init()
        {
            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Service Account Information

            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            //# Service Information

            serviceInstaller.DisplayName = "Audio Windows Service";
            serviceInstaller.Description = "Audio C# Windows Service";
            serviceInstaller.StartType = ServiceStartMode.Manual;

            //# This must be identical to the WindowsService.ServiceBase name

            //# set in the constructor of AudioService.cs

            serviceInstaller.ServiceName = "Audio Windows Service";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.SBWinSVcServiceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
     this.SBWinSvcServiceInstaller        = new System.ServiceProcess.ServiceInstaller();
     //
     // SBWinSVcServiceProcessInstaller
     //
     //this.SBWinSVcServiceProcessInstaller.Password = null;
     //this.SBWinSVcServiceProcessInstaller.Username = null;
     this.SBWinSVcServiceProcessInstaller.Account = ServiceAccount.LocalSystem;
     //
     // SBWinSvcServiceInstaller
     //
     this.SBWinSvcServiceInstaller.ServiceName = "SBWinSvc";
     this.SBWinSvcServiceInstaller.DisplayName = "SpeechBridge Process Manager";
     this.SBWinSvcServiceInstaller.StartType   = ServiceStartMode.Automatic;
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(
         new System.Configuration.Install.Installer[]
     {
         this.SBWinSVcServiceProcessInstaller,
         this.SBWinSvcServiceInstaller
     }
         );
 }
Beispiel #9
0
        public PollServerInstaller()
        {
            InitializeComponent();

            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Service Account Information

            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;

            //# Service Information

            serviceInstaller.DisplayName = "ILS PollServer";
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            //# This must be identical to the WindowsService.ServiceBase name

            //# set in the constructor of WindowsService.cs

            serviceInstaller.ServiceName = "PollServer";

            this.Installers.Add( serviceProcessInstaller );
            this.Installers.Add( serviceInstaller );
        }
        public ArchiServiceInstaller()
        {
            ServiceInstaller serviceInstaller = new ServiceInstaller();
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();

            serviceInstaller.ServiceName = SharedInfo.ServiceName;
            serviceInstaller.DisplayName = SharedInfo.ServiceName;
            serviceInstaller.Description = SharedInfo.ServiceDescription;

            // Defaulting to only starting when a user starts it, can be easily changed after install
            serviceInstaller.StartType = ServiceStartMode.Manual;

            // System account, requires admin privilege to install
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;

            serviceInstaller.Installers.Clear();

            EventLogInstaller logInstaller = new EventLogInstaller {
                Log = SharedInfo.EventLog,
                Source = SharedInfo.EventLogSource
            };

            Installers.Add(serviceInstaller);
            Installers.Add(serviceProcessInstaller);
            Installers.Add(logInstaller);
        }
        public static void InstallService()
        {
            string serviceExecuteblePath = viewModel.InstallFolderPath + $@"\{Settings.ApplicationName}\Service\Service.exe";

            if (!File.Exists(serviceExecuteblePath))
            {
                // Add handler
                return;
            }
            try
            {
                ServiceProcessInstaller ProcesServiceInstaller = new ServiceProcessInstaller();
                ProcesServiceInstaller.Account = ServiceAccount.LocalSystem;
                System.ServiceProcess.ServiceInstaller ServiceInstallerObj = new System.ServiceProcess.ServiceInstaller();
                InstallContext Context = new InstallContext();
                String         path    = $"/assemblypath={serviceExecuteblePath}";
                String[]       cmdline = { path };

                Context = new InstallContext("", cmdline);
                ServiceInstallerObj.Context     = Context;
                ServiceInstallerObj.DisplayName = "Application Service";
                ServiceInstallerObj.Description = "Service for Application";
                ServiceInstallerObj.ServiceName = "ApplicationService";
                ServiceInstallerObj.StartType   = ServiceStartMode.Automatic;
                ServiceInstallerObj.Parent      = ProcesServiceInstaller;

                System.Collections.Specialized.ListDictionary state = new System.Collections.Specialized.ListDictionary();
                ServiceInstallerObj.Install(state);
            }
            catch (Exception e)
            {
                OnInstallError?.Invoke("Error installing service." + e.Message);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;
            

            //# Service Information
            serviceInstaller.DisplayName ="IMES.WatchFolder.Service";
            serviceInstaller.Description = "IMES Watch Folder Service "; 
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            // This must be identical to the WindowsService.ServiceBase name
            // set in the constructor of WindowsService.cs
            //serviceInstaller.ServiceName = "IMES.WatchFolder.Service";
            serviceInstaller.ServiceName = GetConfigurationValue("ServiceName");
            serviceInstaller.DisplayName = GetConfigurationValue("ServiceName");
            serviceInstaller.Description = " IMES Watch Folder/File Service ";
            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            // Construct components as a Container instance
            this.components = new System.ComponentModel.Container();

            this.serviceInstaller        = new System.ServiceProcess.ServiceInstaller();
            this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();

            // serviceInstaller
            this.serviceInstaller.Description = "ConstantsSystemServiceDesc";
            this.serviceInstaller.DisplayName = "ConstantsSystemServiceName";
            this.serviceInstaller.ServiceName = "ConstantsSystemNtServiceName";
            this.serviceInstaller.StartType   = System.ServiceProcess.ServiceStartMode.Automatic;

            // serviceProcessInstaller
            this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;

            // ServiceInstaller
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller,
                this.serviceInstaller
            });

            // Add handler to automatically start service on install
            serviceInstaller.AfterInstall += new System.Configuration.Install.InstallEventHandler(serviceInstaller_AfterInstall);
        }
        private void InitializeComponent()
        {
            this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            this.dnsFlushInstaller       = new System.ServiceProcess.ServiceInstaller();
            //
            // serviceProcessInstaller1
            //
            this.serviceProcessInstaller.Password = null;
            this.serviceProcessInstaller.Username = null;
            //
            // serviceInstaller1
            //
            this.dnsFlushInstaller.ServiceName = "DnsFlusher";
            //
            // ProjectInstaller
            //
            this.dnsFlushInstaller.StartType     = ServiceStartMode.Automatic;
            this.dnsFlushInstaller.Description   = "Flushes the dns every 3 hours";
            this.serviceProcessInstaller.Account = ServiceAccount.LocalSystem;

            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller,
                this.dnsFlushInstaller
            }
                                     );
        }
Beispiel #15
0
 private void InitializeComponent()
 {
     this.WatchMSMQServiceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
     this.WatchMSMQInstaller = new System.ServiceProcess.ServiceInstaller();
     //
     // WatchMSMQServiceProcessInstaller
     //
     this.WatchMSMQServiceProcessInstaller.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.WatchMSMQServiceProcessInstaller.Password = null;
     this.WatchMSMQServiceProcessInstaller.Username = null;
     //
     // WatchMSMQInstaller
     //
     this.WatchMSMQInstaller.DisplayName        = "C# How-To Watch MSMQ";
     this.WatchMSMQInstaller.ServiceName        = "WatchMSMQ";
     this.WatchMSMQInstaller.ServicesDependedOn = new string[] {
         "MSMQ"
     };
     this.WatchMSMQInstaller.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.WatchMSMQInstaller_AfterInstall);
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
         this.WatchMSMQInstaller,
         this.WatchMSMQServiceProcessInstaller
     });
 }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();
            ServiceProcessInstaller processInstaller = new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();
            EventLogInstaller logInstaller = new EventLogInstaller();

            logInstaller.Log = "Application";
            logInstaller.Source = "sdsupportsvc";

            processInstaller.Account = ServiceAccount.LocalSystem;
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            serviceInstaller.ServiceName = "sdsupportsvc";
            serviceInstaller.DisplayName = "SD Support Host Service";
            serviceInstaller.Description = "Hosts an Azure Net Relay WCF service which support sdsupport.apphb.com";

            for (var t = 0; t < Installers.Count; t++)
            {
                if (Installers[t] is EventLogInstaller)
                {
                    Installers.Remove(Installers[t]);
                    break;
                }
            }

            Installers.Add(logInstaller);
            Installers.Add(processInstaller);
            Installers.Add(serviceInstaller);
            
        }
Beispiel #17
0
        public ServiceInstaller()
        {
            ServiceNameDescription[] services =
            {
                new ServiceNameDescription(SystemMailMessageService.Name, SystemMailMessageService.Description),
                new ServiceNameDescription(SystemReminderService.Name,    SystemReminderService.Description),
                new ServiceNameDescription(SystemSMTPMessageService.Name, SystemSMTPMessageService.Description),
                new ServiceNameDescription(SystemTagWordService.Name,     SystemTagWordService.Description),
                new ServiceNameDescription(SystemSyndicationService.Name, SystemSyndicationService.Description),
                new ServiceNameDescription(SystemThumbnailService.Name,   SystemThumbnailService.Description)
            };

            foreach (ServiceNameDescription service in services)
            {
                System.ServiceProcess.ServiceInstaller serviceInstaller = new System.ServiceProcess.ServiceInstaller();
                serviceInstaller.ServiceName = service.name;
                serviceInstaller.DisplayName = service.name;
                serviceInstaller.Description = service.description;
                serviceInstaller.StartType   = ServiceStartMode.Automatic;

                SnCoreServiceProcessInstaller serviceProcessInstaller = new SnCoreServiceProcessInstaller(service.name);
                serviceProcessInstaller.Account  = ServiceAccount.LocalSystem;
                serviceProcessInstaller.Username = null;
                serviceProcessInstaller.Password = null;
                serviceProcessInstaller.Installers.Add(serviceInstaller);

                Installers.Add(serviceProcessInstaller);
            }
        }
Beispiel #18
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();

            this.BeforeInstall   += new System.Configuration.Install.InstallEventHandler(ProjectInstaller_BeforeInstall);
            this.BeforeUninstall += new System.Configuration.Install.InstallEventHandler(ProjectInstaller_BeforeUninstall);


            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
            //
            // serviceProcessInstaller1
            //
            this.serviceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceProcessInstaller1.Password = null;
            this.serviceProcessInstaller1.Username = null;
            //
            // serviceInstaller1
            //
            this.serviceInstaller1.Description   = "MSB Virus Sentry";
            this.serviceInstaller1.DisplayName   = "MSB Virus Sentry";
            this.serviceInstaller1.ServiceName   = "MSB_Virus_Sentry";
            this.serviceInstaller1.StartType     = System.ServiceProcess.ServiceStartMode.Automatic;
            this.serviceInstaller1.AfterInstall += SentryInstaller_AfterInstall;


            //
            // ProjectInstaller
            //

            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller1,
                this.serviceInstaller1
            });
        }
Beispiel #19
0
        public Installer()
        {
            InitializeComponent();

            this.ServiceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
            // 
            // ServiceProcessInstaller1
            // 
            this.ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.ServiceProcessInstaller1.Password = null;
            this.ServiceProcessInstaller1.Username = null;
            // 
            // serviceInstaller1
            // 
            this.serviceInstaller1.DisplayName = "dp2 Kernel Service";
            this.serviceInstaller1.ServiceName = "dp2KernelService";
            this.serviceInstaller1.Description = "dp2内核,数字平台北京软件有限责任公司 http://dp2003.com";
            this.serviceInstaller1.StartType = ServiceStartMode.Automatic;
            /*
            this.serviceInstaller1.ServicesDependedOn = new string[] {
                "W3SVC"};
             * */
            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
				this.ServiceProcessInstaller1,
				this.serviceInstaller1});

            this.serviceInstaller1.Committed += new InstallEventHandler(serviceInstaller1_Committed); 
        }
        /// <summary>
        /// Constructor e instalador de servcios.
        /// </summary>
        public WCFAPIServerInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Cuenta local de Usuario para ejecucion del servicio
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            string name = System.Configuration.ConfigurationManager.AppSettings["ServiceInstaller.Name"];
            string description = System.Configuration.ConfigurationManager.AppSettings["ServiceInstaller.Description"];

            if (string.IsNullOrEmpty(name))
            {
                name = "WCF-API Server Provider";
            }
            if (string.IsNullOrEmpty(description))
            {
                description = "WCF-API Server Provider. Provider/Publisher WCF interfaces Service .";
            }
            //# Informacion del servicio
            serviceInstaller.DisplayName = name;  //Cambiar este valor con el nombre del servicio
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            serviceInstaller.ServiceName = name; //Cambiar este valor con el nombre del servicio
            serviceInstaller.Description = description;
                ; //Descripcion del servicio (opcional)

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.spInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            this.srvcInstaller = new System.ServiceProcess.ServiceInstaller();
            // 
            // spInstaller
            // 
            this.spInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.spInstaller.Password = null;
            this.spInstaller.Username = null;
            // 
            // srvcInstaller
            // 
            this.srvcInstaller.ServiceName = "WMS 3.0 WCF Service";
            this.srvcInstaller.Description = "Manage the WCF Service (Communication Foundation).";
            this.srvcInstaller.DisplayName = "WMS 3.0 WCF Service";
            this.srvcInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;

            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(new System.Configuration.Install.Installer[] 
            { this.spInstaller, this.srvcInstaller });

        }
Beispiel #22
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            var serviceProcessInstaller =
                               new ServiceProcessInstaller();
            var serviceInstaller
                = new ServiceInstaller();

            //# Service Account Information

            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            //# Service Information

            serviceInstaller.DisplayName = "NP2COMService";
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            //# This must be identical to the WindowsService.ServiceBase name

            //# set in the constructor of WindowsService.cs

            serviceInstaller.ServiceName = "NP2COMService";

            Installers.Add(serviceProcessInstaller);
            Installers.Add(serviceInstaller);
        }
        public ProjectInstaller(string svcname, string username, string password)
        {
            System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            System.ServiceProcess.ServiceInstaller        serviceInstaller        = new System.ServiceProcess.ServiceInstaller();

            //  check for special users as localsystem, networkservice and localservice
            if (username == null || username.ToLower() == "localsystem")
            {
                serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            }
            else if (username.ToLower() == "networkservice")
            {
                serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.NetworkService;
            }
            else if (username.ToLower() == "localservice")
            {
                serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalService;
            }
            else
            {
                serviceProcessInstaller.Account  = System.ServiceProcess.ServiceAccount.User;
                serviceProcessInstaller.Username = username;
                serviceProcessInstaller.Password = password;
            }

            serviceInstaller.ServiceName = svcname;
            serviceInstaller.StartType   = System.ServiceProcess.ServiceStartMode.Automatic;
            serviceInstaller.Description = "Service broker external activator";
            serviceInstaller.DisplayName = "External Activator - " + svcname;

            Installers.AddRange(new System.Configuration.Install.Installer[] { serviceProcessInstaller, serviceInstaller });
        }
Beispiel #24
0
 private void InitializeComponent()
 {
     this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
     this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
     //
     // serviceInstaller1
     //
     this.serviceInstaller1.Description = "Management Service by Roger Zander";
     this.serviceInstaller1.DisplayName = "Device Commander Agent";
     this.serviceInstaller1.ServiceName = "DevCDRAgent";
     this.serviceInstaller1.StartType   = System.ServiceProcess.ServiceStartMode.Automatic;
     //
     // serviceProcessInstaller1
     //
     this.serviceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.serviceProcessInstaller1.Password = null;
     this.serviceProcessInstaller1.Username = null;
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
         this.serviceInstaller1,
         this.serviceProcessInstaller1
     });
 }
 public CassetteHostServiceInstaller()
 {
     var process = new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem };
     var service = new ServiceInstaller { ServiceName = CassetteHostingService.CassetteServiceName };
     Installers.Add(process);
     Installers.Add(service);
 }
        public void Install()
        {
            if (ServiceExists())
            {
                logger.Warn("The service is already installed!");
            }
            else
            {
                var installer = new ServiceProcessInstaller
                {
                    Account = ServiceAccount.LocalSystem
                };

                var serviceInstaller = new ServiceInstaller();

                var exePath = Path.Combine(configService.ApplicationFolder(), SERVICEEXE);
                if (!File.Exists(exePath) && Debugger.IsAttached)
                {
                    exePath = Path.Combine(configService.ApplicationFolder(), "..\\..\\..\\Jackett.Service\\bin\\Debug", SERVICEEXE);
                }

                string[] cmdline = { @"/assemblypath=" + exePath};

                var context = new InstallContext("jackettservice_install.log", cmdline);
                serviceInstaller.Context = context;
                serviceInstaller.DisplayName = NAME;
                serviceInstaller.ServiceName = NAME;
                serviceInstaller.Description = DESCRIPTION;
                serviceInstaller.StartType = ServiceStartMode.Automatic;
                serviceInstaller.Parent = installer;

                serviceInstaller.Install(new ListDictionary());
            }
        }
Beispiel #27
0
        public static void Install(string serviceName, bool undo, string[] args, string serviceDisplayName = null, string description = null)
        {
            try
            {
                Console.WriteLine(undo ? "uninstalling" : "installing");
                using (var inst = new AssemblyInstaller(Assembly.GetEntryAssembly(), args))
                {
                    var processInstaller = new ServiceProcessInstaller
                    {
                        Account = ServiceAccount.LocalSystem
                    };

                    var serviceInstaller = new System.ServiceProcess.ServiceInstaller
                    {
                        StartType   = ServiceStartMode.Automatic,
                        ServiceName = serviceName,
                        DisplayName = serviceDisplayName ?? Regex.Replace(serviceName, "(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", " "),
                        Description = description
                    };

                    inst.Installers.Add(processInstaller);
                    inst.Installers.Add(serviceInstaller);

                    IDictionary state = new Hashtable();
                    inst.UseNewContext = true;
                    try
                    {
                        if (undo)
                        {
                            var sc = new ServiceController(serviceName);
                            if (sc.Status == ServiceControllerStatus.Running)
                            {
                                sc.Stop();
                            }
                            inst.Uninstall(state);
                        }
                        else
                        {
                            inst.BeforeInstall += (s, e) => { inst.Context.Parameters["assemblyPath"] = $@"""{inst.Context.Parameters["assemblyPath"]}"" --service"; };
                            inst.AfterInstall  += (s, e) => { new ServiceController(serviceName).Start(); };
                            inst.Install(state);
                            inst.Commit(state);
                        }
                    }
                    catch
                    {
                        try
                        {
                            inst.Rollback(state);
                        }
                        catch { }
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
            }
        }
 public ProjectInstaller()
 {
     _process = new ServiceProcessInstaller {Account = ServiceAccount.LocalSystem};
     _service = new ServiceInstaller { ServiceName = GlobalSettings.ApplicationName };
     Installers.Add(_process);
     Installers.Add(_service);
 }
Beispiel #29
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
     this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
     //
     // serviceProcessInstaller1
     //
     this.serviceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.serviceProcessInstaller1.Password = null;
     this.serviceProcessInstaller1.Username = null;
     //
     // serviceInstaller1
     //
     this.serviceInstaller1.ServiceName        = "XPLLogger";
     this.serviceInstaller1.ServicesDependedOn = new string[] {
         ""
     };
     this.serviceInstaller1.StartType        = System.ServiceProcess.ServiceStartMode.Automatic;
     this.serviceInstaller1.BeforeUninstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_BeforeUninstall);
     this.serviceInstaller1.AfterInstall    += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
         this.serviceProcessInstaller1,
         this.serviceInstaller1
     });
 }
Beispiel #30
0
        /// <summary>
        /// Инициализирует коллекцию объектов Installer.
        /// </summary>
        /// <remarks>
        /// Имя и отображаемое имя службы устанавливаются в файле конфигурации.
        /// </remarks>
        protected ServiceInstaller()
        {
            var assemblyName = GetType().Assembly.GetName().Name;

            ServiceName        = AppConfig.Setting("service_name", assemblyName);
            ServiceDisplayName = AppConfig.Setting("service_display_name", ServiceName);
            ServiceDescription = AppConfig.Setting("service_description", ServiceDisplayName);

            //
            //    ReSharper disable DoNotCallOverridableMethodsInConstructor
            //
            var serviceInstaller = new System.ServiceProcess.ServiceInstaller
            {
                Description = ServiceDescription,
                ServiceName = ServiceName,
                DisplayName = ServiceDisplayName,
            };
            //
            //    ReSharper restore DoNotCallOverridableMethodsInConstructor
            //

            var serviceProcessInstaller = new ServiceProcessInstaller
            {
                Account  = ServiceAccount.LocalSystem,
                Password = null,
                Username = null
            };

            Installers.AddRange(new Installer[] { serviceInstaller, serviceProcessInstaller });
        }
Beispiel #31
0
        public Installer1()
        {
            InitializeComponent();

            this.ServiceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
            //
            // ServiceProcessInstaller1
            //
            this.ServiceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem; // LocalSystem
            this.ServiceProcessInstaller1.Password = null;
            this.ServiceProcessInstaller1.Username = null;
            //
            // serviceInstaller1
            //
            this.serviceInstaller1.DisplayName = "dp2 Library Service";
            this.serviceInstaller1.ServiceName = "dp2LibraryService";
            this.serviceInstaller1.Description = "dp2图书馆应用服务器,数字平台北京软件有限责任公司 http://dp2003.com";
            this.serviceInstaller1.StartType   = ServiceStartMode.Automatic;

            /* // dp2Library和dp2Kernel可以不在同一台机器,所以不能设定依赖关系
             * this.serviceInstaller1.ServicesDependedOn = new string[] {
             *  "dp2KernelService"};
             * */
            //
            // ProjectInstaller
            //
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.ServiceProcessInstaller1,
                this.serviceInstaller1
            });

            this.serviceInstaller1.Committed += new InstallEventHandler(serviceInstaller1_Committed);
        }
Beispiel #32
0
 /// <summary>
 ///    Required method for Designer support - do not modify
 ///    the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceInstaller        = new System.ServiceProcess.ServiceInstaller();
     this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
     //
     // serviceInstaller
     //
     this.serviceInstaller.Description = "YUpdatePricePart";
     this.serviceInstaller.DisplayName = "YUpdatePricePart";
     this.serviceInstaller.ServiceName = "YUpdatePricePart";
     this.serviceInstaller.StartType   = System.ServiceProcess.ServiceStartMode.Automatic;
     //
     // serviceProcessInstaller
     //
     this.serviceProcessInstaller.Account  = System.ServiceProcess.ServiceAccount.LocalService;
     this.serviceProcessInstaller.Password = null;
     this.serviceProcessInstaller.Username = null;
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
         this.serviceProcessInstaller,
         this.serviceInstaller
     });
 }
Beispiel #33
0
        private void InitializeComponent()
        {
            this.serviceRefProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceRefInstaller        = new System.ServiceProcess.ServiceInstaller();
            //
            // serviceRefProcessInstaller
            //
            this.serviceRefProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceRefInstaller.StartType      = System.ServiceProcess.ServiceStartMode.Automatic;

            //
            // serviceRefInstaller
            //
            this.serviceRefInstaller.DisplayName = ReflectorMgr.ReflectorServiceName;
            this.serviceRefInstaller.ServiceName = ReflectorMgr.ReflectorServiceName;
            //
            // ProjectInstaller
            //
            this.Installers.AddRange(new System.Configuration.Install.Installer[]
            {
                this.serviceRefProcessInstaller,
                this.serviceRefInstaller
            }
                                     );
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     _serviceProcessInstaller = new ServiceProcessInstaller();
     _serviceInstaller = new ServiceInstaller();
     // 
     // _serviceProcessInstaller
     // 
     _serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
     _serviceProcessInstaller.Password = null;
     _serviceProcessInstaller.Username = null;
     // 
     // _serviceInstaller
     // 
     _serviceInstaller.DelayedAutoStart = true;
     _serviceInstaller.Description = "Эта служба собирает почту с различный ящиков";
     _serviceInstaller.DisplayName = "Служба сбора почты";
     _serviceInstaller.ServiceName = "TopCrawler";
     _serviceInstaller.StartType = ServiceStartMode.Automatic;
     // 
     // ProjectInstaller
     // 
     Installers.AddRange(new Installer[] {
     _serviceProcessInstaller,
     _serviceInstaller});
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
     this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
     //
     // serviceProcessInstaller1
     //
     this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.serviceProcessInstaller1.Password = null;
     this.serviceProcessInstaller1.Username = null;
     //
     // serviceInstaller1
     //
     this.serviceInstaller1.ServiceName = "XPLLogger";
     this.serviceInstaller1.ServicesDependedOn = new string[] {
                                                                  ""};
     this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
     this.serviceInstaller1.BeforeUninstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_BeforeUninstall);
     this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                                                                               this.serviceProcessInstaller1,
                                                                               this.serviceInstaller1});
 }
Beispiel #36
0
        public virtual void Install(string serviceName)
        {
            _logger.Info("Installing service '{0}'", serviceName);

            var installer = new ServiceProcessInstaller
                                {
                                    Account = ServiceAccount.LocalSystem
                                };

            var serviceInstaller = new ServiceInstaller();

            String[] cmdline = { @"/assemblypath=" + Process.GetCurrentProcess().MainModule.FileName };

            var context = new InstallContext("service_install.log", cmdline);
            serviceInstaller.Context = context;
            serviceInstaller.DisplayName = serviceName;
            serviceInstaller.ServiceName = serviceName;
            serviceInstaller.Description = "NzbDrone Application Server";
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.ServicesDependedOn = new[] { "EventLog", "Tcpip" };

            serviceInstaller.Parent = installer;

            serviceInstaller.Install(new ListDictionary());

            _logger.Info("Service Has installed successfully.");
        }
Beispiel #37
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            //
            // serviceProcessInstaller1
            //
            serviceProcessInstaller1          = new System.ServiceProcess.ServiceProcessInstaller();
            serviceProcessInstaller1.Account  = ServiceAccount.LocalSystem;
            serviceProcessInstaller1.Password = null;
            serviceProcessInstaller1.Username = null;
            //
            // serviceInstaller1
            //
            serviceInstaller1             = new System.ServiceProcess.ServiceInstaller();
            serviceInstaller1.ServiceName = "StationMockService";
            serviceInstaller1.StartType   = ServiceStartMode.Automatic;

            //
            // ProjectInstaller
            //
            this.Installers.AddRange(
                new System.Configuration.Install.Installer[]
            {
                this.serviceProcessInstaller1,
                this.serviceInstaller1
            }
                );
        }
        private void DefaultInstaller_BeforeInstall(object sender, InstallEventArgs e)
        {
            ServiceInstaller serviceInstaller = new ServiceInstaller()
            {
                Description = "MSMQ Monitor",
                StartType = ServiceStartMode.Automatic,
            };

            string name = Context.Parameters["name"];
            if (!string.IsNullOrEmpty(name))
            {
                serviceInstaller.ServiceName = name;
            }
            else
            {
                serviceInstaller.ServiceName = "MSMQ.Monitor";
            }

            ServiceProcessInstaller processInstaller = new ServiceProcessInstaller()
            {
                Account = ServiceAccount.LocalSystem
            };

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
Beispiel #39
0
        public Installer()
        {
            InitializeComponent();

            string name = "WordGuessServer";

            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
            //
            // serviceProcessInstaller1
            //
            this.serviceProcessInstaller1.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceProcessInstaller1.Password = null;
            this.serviceProcessInstaller1.Username = null;
            //
            // serviceInstaller1
            //
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.serviceInstaller1.Description = string.Format("{0} - {1}", name, version);
            this.serviceInstaller1.DisplayName = name;
            this.serviceInstaller1.ServiceName = name;

            this.serviceInstaller1.ServicesDependedOn = new string[] { "" };
            //
            // Installer
            //
            this.Installers.AddRange(new System.Configuration.Install.Installer[]
            {
                this.serviceProcessInstaller1,
                this.serviceInstaller1
            }
                                     );
        }
Beispiel #40
0
        public InstallerSrv()
        {
            string logname = "GranityLog";

            InitializeComponent();
            //��װ��־
            if (EventLog.Exists(logname))
                EventLog.Delete(logname);
            if (EventLog.SourceExists(logname))
                EventLog.DeleteEventSource(logname);
            EventLogInstaller log = new EventLogInstaller();
            log.Source = logname;
            log.Log = logname;
            this.Installers.Add(log);

            //��װ����
            ServiceProcessInstaller prsInstaller = new ServiceProcessInstaller();
            ServiceInstaller srvInstall = new ServiceInstaller();

            // The services run under the system account.
            prsInstaller.Account = ServiceAccount.LocalSystem;
            prsInstaller.Username = null;
            prsInstaller.Password = null;

            // The services are started manually.
            srvInstall.StartType = ServiceStartMode.Automatic;
            srvInstall.ServiceName = "Granity�ļ�����";
            srvInstall.Description = "�Ϻ�����˾��ͣ����ץ��ͼƬ�ļ�����";

            // Add installers to collection. Order is not important.
            Installers.Add(srvInstall);
            Installers.Add(prsInstaller);
        }
        private void InitializeComponent()
        {
            this.components = new Container();

            this.serviceProcessInstaller = new ServiceProcessInstaller();
            this.serviceInstaller = new ServiceInstaller();

            // serviceProcessInstaller
            this.serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            this.serviceProcessInstaller.Password = null;
            this.serviceProcessInstaller.Username = null;

            // serviceInstaller
            this.serviceInstaller.DisplayName = ServiceHostSettings.ServiceName;
            this.serviceInstaller.ServiceName = ServiceHostSettings.ServiceName;
            this.serviceInstaller.Description = ServiceHostSettings.ServiceDescription;
            this.serviceInstaller.StartType = ServiceStartMode.Manual;

            // ProjectInstaller
            this.Installers.AddRange(new Installer[]
            {
                this.serviceProcessInstaller,
                this.serviceInstaller
            });
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            // Construct components as a Container instance
            this.components = new System.ComponentModel.Container();

            this.serviceInstaller        = new System.ServiceProcess.ServiceInstaller();
            this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();

            // serviceInstaller
            this.serviceInstaller.Description = Constants.System.ServiceDesc;
            this.serviceInstaller.DisplayName = Constants.System.NtServiceName;
            this.serviceInstaller.ServiceName = Constants.System.ServiceKey;
            this.serviceInstaller.StartType   = System.ServiceProcess.ServiceStartMode.Automatic;

            // serviceProcessInstaller - uncomment the next line and comment the one after if you need to run this with a regular user account
            // Setting this up as a NetworkService makes it run under a Service account, with email sent via a service account too - password in CorpMailman.exe.config
//            this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User;
            this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.NetworkService;

            // ServiceInstaller
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller,
                this.serviceInstaller
            });

            // Add handler to automatically start service on install
            serviceInstaller.AfterInstall += new System.Configuration.Install.InstallEventHandler(serviceInstaller_AfterInstall);
        }
        public ServiceDeploy()
        {
            string serviceName = Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location);

            //string[] splitValues = serviceName.Split('.');

            //string displayName = "RestServiceHost - " + splitValues[splitValues.Length - 1];
            string displayName = "RestServiceHost - TestService";

            var processInstaller = new ServiceProcessInstaller();
            var serviceInstaller = new ServiceInstaller();

            //set the privileges
            processInstaller.Account = ServiceAccount.User;

            serviceInstaller.DisplayName = displayName;
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.DelayedAutoStart = true;
            serviceInstaller.Description = "Seld Hosted Rest Service";

            //must be the same as what was set in Program's constructor
            serviceInstaller.ServiceName = serviceName;
            this.Installers.Add(processInstaller);
            this.Installers.Add(serviceInstaller);
        }
   public SocketServiceInstaller()
   {
       this.InitializeComponent();
       this.processInstaller = new ServiceProcessInstaller();
       this.serviceInstaller = new ServiceInstaller();
       this.processInstaller.Account = ServiceAccount.LocalSystem;
       this.serviceInstaller.StartType = ServiceStartMode.Automatic;
       this.serviceInstaller.ServiceName = ConfigurationManager.AppSettings["ServiceName"];
       string str1 = ConfigurationManager.AppSettings["ServiceDescription"];
       if (!string.IsNullOrEmpty(str1))
           this.serviceInstaller.Description = str1;
       List<string> list = new List<string>()
 {
   "tcpip"
 };
       string str2 = ConfigurationManager.AppSettings["ServicesDependedOn"];
       if (!string.IsNullOrEmpty(str2))
           list.AddRange((IEnumerable<string>)str2.Split(new char[2]
   {
     ',',
     ';'
   }));
       this.serviceInstaller.ServicesDependedOn = list.ToArray();
       this.Installers.Add((Installer)this.serviceInstaller);
       this.Installers.Add((Installer)this.processInstaller);
   }
Beispiel #45
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.PdfCombinerServiceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
     this.PdfConbinerServiceInstaller        = new System.ServiceProcess.ServiceInstaller();
     //
     // PdfCombinerServiceProcessInstaller
     //
     this.PdfCombinerServiceProcessInstaller.Account  = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.PdfCombinerServiceProcessInstaller.Password = null;
     this.PdfCombinerServiceProcessInstaller.Username = null;
     //
     // PdfConbinerServiceInstaller
     //
     this.PdfConbinerServiceInstaller.Description   = "Сервис формирования интерактивного PDF";
     this.PdfConbinerServiceInstaller.DisplayName   = "PdfCombiner v1.0";
     this.PdfConbinerServiceInstaller.ServiceName   = "PdfCombiner";
     this.PdfConbinerServiceInstaller.StartType     = ServiceStartMode.Automatic;
     this.PdfConbinerServiceInstaller.AfterInstall += ServiceInstaller_AfterInstall;
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new Installer[]
     {
         this.PdfCombinerServiceProcessInstaller,
         this.PdfConbinerServiceInstaller
     });
 }
        public NDockServiceInstaller()
        {
            InitializeComponent();

            processInstaller = new ServiceProcessInstaller();
            serviceInstaller = new ServiceInstaller();

            processInstaller.Account = ServiceAccount.LocalSystem;
            serviceInstaller.StartType = ServiceStartMode.Automatic;
            serviceInstaller.ServiceName = ConfigurationManager.AppSettings["ServiceName"];

            var serviceDescription = ConfigurationManager.AppSettings["ServiceDescription"];
            if (!string.IsNullOrEmpty(serviceDescription))
                serviceInstaller.Description = serviceDescription;

            var servicesDependedOn = new List<string> { "tcpip" };
            var servicesDependedOnConfig = ConfigurationManager.AppSettings["ServicesDependedOn"];

            if (!string.IsNullOrEmpty(servicesDependedOnConfig))
                servicesDependedOn.AddRange(servicesDependedOnConfig.Split(new char[] { ',', ';' }));

            serviceInstaller.ServicesDependedOn = servicesDependedOn.ToArray();

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
Beispiel #47
0
 public ServiceBusInstaller()
 {
     process = new ServiceProcessInstaller {Account = ServiceAccount.LocalSystem};
     service = new ServiceInstaller {ServiceName = "WCF Service Bus"};
     Installers.Add(process);
     Installers.Add(service);
 }
Beispiel #48
0
        /// <summary>
        /// 安装
        /// </summary>
        public ProjectInstaller()
        {
            InitializeComponent(); //在安装中取得配置中的名字必须。
            Committed += ServiceInstallerCommitted;

            var serviceName = ConfigurationManager.AppSettings["ServiceName"].Trim();
            var displayName = ConfigurationManager.AppSettings["ServiceDisplayName"].Trim();
            var desc = ConfigurationManager.AppSettings["ServiceDescription"].Trim();
            if (!string.IsNullOrEmpty(serviceName)) ConfigServiceName = serviceName;
            if (!string.IsNullOrEmpty(displayName)) DisplayName = displayName;
            if (!string.IsNullOrEmpty(desc)) ConfigDescription = desc;

            var processInstaller = new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem };
            var serviceInstaller = new ServiceInstaller
            {
                //自动启动服务,手动的话,每次开机都要手动启动。
                StartType = ServiceStartMode.Automatic,

                DisplayName = DisplayName,
                ServiceName = ConfigServiceName,
                Description = ConfigDescription
            };

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
Beispiel #49
0
        /// <summary>
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        /// </summary>
        public WindowsServiceInstaller()
        {
            SpaceEngineersGame.SetupPerGameSettings();

            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            m_serviceInstaller = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;



            m_serviceInstaller.DisplayName = MyPerServerSettings.GameName + " dedicated server";
            //# This must be identical to the WindowsService.ServiceBase name
            //# set in the constructor of WindowsService.cs
            m_serviceInstaller.ServiceName = m_serviceInstaller.DisplayName;
            m_serviceInstaller.Description = MyPerServerSettings.GameDSDescription;

            this.Installers.Add(m_serviceInstaller);

            //# Service Information            
            m_serviceInstaller.StartType = ServiceStartMode.Automatic;
            this.Installers.Add(serviceProcessInstaller);
        }
Beispiel #50
0
        //private FileLogger _logger;
        public EFxServiceInstaller()
        {
            //InitializeComponent();
            _serviceProcessInstaller = new ServiceProcessInstaller
            {
                Account = ServiceAccount.NetworkService,
                Username = null,
                Password = null
            };

            _serviceInstaller = new ServiceInstaller
            {
                DisplayName = ConfigurationManager.AppSettings["serviceName"],
                ServiceName = ConfigurationManager.AppSettings["serviceName"],
                Description = ConfigurationManager.AppSettings["serviceName"],
                StartType = ServiceStartMode.Automatic
            };

            Installers.AddRange(new Installer[]
            {
                _serviceProcessInstaller,
                _serviceInstaller
            });

            //_logger = new FileLogger();
        }
Beispiel #51
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
     this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
     //
     // serviceProcessInstaller1
     //
     this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.serviceProcessInstaller1.Password = null;
     this.serviceProcessInstaller1.Username = null;
     this.serviceProcessInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_AfterInstall);
     //
     // serviceInstaller1
     //
     this.serviceInstaller1.ServiceName = "CardReaderService";
     this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
     this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
     this.serviceProcessInstaller1,
     this.serviceInstaller1});
     this.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.ProjectInstaller_AfterInstall);
 }
Beispiel #52
0
        protected void Install(ServiceConfiguration configuration)
        {
            try
            {
                var serviceInstaller = new System.ServiceProcess.ServiceInstaller
                {
                    DelayedAutoStart   = configuration.DelayedAutoStart,
                    Description        = configuration.Description,
                    DisplayName        = configuration.DisplayName,
                    ServiceName        = configuration.ServiceName,
                    ServicesDependedOn = configuration.ServicesDependedOn,
                    StartType          = configuration.StartType,
                };

                var serviceProcessInstaller = new ServiceProcessInstaller
                {
                    Account  = configuration.Account,
                    Username = configuration.Username,
                    Password = configuration.Password,
                };

                Installers.Add(serviceInstaller);
                Installers.Add(serviceProcessInstaller);
            }
            catch (Exception e)
            {
                ILogger emergencyLogger = EmergencyLogger.Instance;
                emergencyLogger.Log(LogCatagory.Error, e, "ServiceInstaller caught an unexpected exception while attempting to create installers.");
                throw;
            }
        }
Beispiel #53
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
     this.serviceInstaller1        = new System.ServiceProcess.ServiceInstaller();
     //
     // serviceProcessInstaller1
     //
     this.serviceProcessInstaller1.Account       = System.ServiceProcess.ServiceAccount.LocalSystem;
     this.serviceProcessInstaller1.Password      = null;
     this.serviceProcessInstaller1.Username      = null;
     this.serviceProcessInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_AfterInstall);
     //
     // serviceInstaller1
     //
     this.serviceInstaller1.ServiceName   = "CardReaderService";
     this.serviceInstaller1.StartType     = System.ServiceProcess.ServiceStartMode.Automatic;
     this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
     //
     // ProjectInstaller
     //
     this.Installers.AddRange(new System.Configuration.Install.Installer[] {
         this.serviceProcessInstaller1,
         this.serviceInstaller1
     });
     this.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.ProjectInstaller_AfterInstall);
 }
        public ProjectInstaller()
        {
            InitializeComponent();

            processInstaller = new ServiceProcessInstaller();
            serviceInstaller = new System.ServiceProcess.ServiceInstaller();
        }
Beispiel #55
0
        /// <summary>
        /// Default Installation Logic
        /// </summary>
        #region Installer Functions
        private void InitializeComponent()
        {
            _serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
            _serviceInstaller        = new System.ServiceProcess.ServiceInstaller();

            Installers.Add(_serviceProcessInstaller);
            Installers.Add(_serviceInstaller);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private System.ServiceProcess.ServiceInstaller GetServiceInstaller()
        {
            System.ServiceProcess.ServiceInstaller installer = new System.ServiceProcess.ServiceInstaller();
            installer.ServiceName = GetConfigurationValue("ServiceName");
            installer.Description = GetConfigurationValue("ServiceDescription");

            return(installer);
        }
        private void RemoveService()
        {
            System.ServiceProcess.ServiceInstaller ServiceInstallerObj = new System.ServiceProcess.ServiceInstaller();
            InstallContext Context = new InstallContext(@"C:\temp\MSB_Virus_Sentry.log", null);

            ServiceInstallerObj.Context     = Context;
            ServiceInstallerObj.ServiceName = "MSB_Virus_Sentry";
            ServiceInstallerObj.Uninstall(null);
        }
Beispiel #58
0
            public void Uninstall(String ServiceName)
            {
                System.ServiceProcess.ServiceInstaller SINST = new System.ServiceProcess.ServiceInstaller();

                System.Configuration.Install.InstallContext Context = new System.Configuration.Install.InstallContext("c:\\install.log", null);
                SINST.Context     = Context;
                SINST.ServiceName = ServiceName;
                SINST.Uninstall(null);
            }
        /// <summary>
        /// UninstallService
        /// </summary>
        /// <param name="serviceName"></param>
        public void UninstallService(string serviceName)
        {
            System.ServiceProcess.ServiceInstaller ServiceInstallerObj = new System.ServiceProcess.ServiceInstaller();
            InstallContext Context = new InstallContext(null, null);

            ServiceInstallerObj.Context     = Context;
            ServiceInstallerObj.ServiceName = serviceName;
            ServiceInstallerObj.Uninstall(null);
        }
Beispiel #60
0
 public ServiceInstaller()
 {
     process             = new ServiceProcessInstaller();
     process.Account     = ServiceAccount.NetworkService;
     service             = new System.ServiceProcess.ServiceInstaller();
     service.ServiceName = Resources.ServiceName;
     service.Description = Resources.Description;
     Installers.Add(process);
     Installers.Add(service);
 }