Export (0) Print
Expand All

ServiceInstaller Constructor

Initializes a new instance of the ServiceInstaller class.

Namespace:  System.ServiceProcess
Assembly:  System.ServiceProcess (in System.ServiceProcess.dll)

public ServiceInstaller()

To install a service, create a project installer class that inherits from the Installer class, and set the RunInstallerAttribute attribute on the class to true. Within your project, create one ServiceProcessInstaller instance per service application, and one ServiceInstaller instance for each service in the application. Within your project installer class constructor, set the installation properties for the service using the ServiceProcessInstaller and ServiceInstaller instances, and add the instances to the Installers collection.

The ServiceInstaller constructor automatically generates an event log source whose Log property is set to the computer's Application log, and an EventLogInstaller. When you set the ServiceName of the ServiceInstaller, which should be identical to the ServiceBase.ServiceName of the service, the Source property of the event log is automatically set to the same value. The source is deleted automatically in the case of an installation failure.

The ServiceInstaller constructor sets the StartType property to ServiceStartMode.Manual to specify that a user start the service. You can reset the property to ServiceStartMode.Automatic to specify that the service start when the computer reboots.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft