This topic has not yet been rated - Rate this topic

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, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ