This documentation is archived and is not being maintained.

ServiceBase Members

ServiceBase overview

Public Constructors

public constructorServiceBase Constructor Creates a new instance of the ServiceBase class.

Public Fields

public fieldstatic (Shared in Visual Basic)MaxNameLength Indicates the maximum size for a service name.

Public Properties

public propertyAutoLog Indicates whether to report Start, Stop, Pause, and Continue commands in the event log.
public propertyCanHandlePowerEvent Gets or sets a value indicating whether the service can handle notifications of computer power status changes.
public propertyCanPauseAndContinue Gets or sets a value indicating whether the service can be paused and resumed.
public propertyCanShutdown Gets or sets a value indicating whether the service should be notified when the system is shutting down.
public propertyCanStop Gets or sets a value indicating whether the service can be stopped once it has started.
public propertyContainer (inherited from Component) Gets the IContainer that contains the Component.
public propertyEventLog Gets an event log you can use to write notification of service command calls, such as Start and Stop, to the Application event log.
public propertyServiceName Gets or sets the short name used to identify the service to the system.
public propertySite (inherited from Component) Gets or sets the ISite of the Component.

Public Methods

public methodCreateObjRef (inherited from MarshalByRefObject) Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
public methodDispose (inherited from Component) Overloaded. Releases the resources used by the Component.
public methodEquals (inherited from Object) Overloaded. Determines whether two Object instances are equal.
public methodGetHashCode (inherited from Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
public methodGetLifetimeService (inherited from MarshalByRefObject) Retrieves the current lifetime service object that controls the lifetime policy for this instance.
public methodGetType (inherited from Object) Gets the Type of the current instance.
public methodInitializeLifetimeService (inherited from MarshalByRefObject) Obtains a lifetime service object to control the lifetime policy for this instance.
public methodstatic (Shared in Visual Basic)Run Overloaded. Provides the main entry point for a service executable.
public methodToString (inherited from Object) Returns a String that represents the current Object.

Public Events

public eventDisposed (inherited from Component) Adds an event handler to listen to the Disposed event on the component.

Protected Properties

protected propertyDesignMode (inherited from Component) Gets a value that indicates whether the Component is currently in design mode.
protected propertyEvents (inherited from Component) Gets the list of event handlers that are attached to this Component.

Protected Methods

protected methodDispose Overloaded. Overridden. See Component.Dispose.
protected methodFinalize (inherited from Component) Overridden. Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.

In C# and C++, finalizers are expressed using destructor syntax.

protected methodGetService (inherited from Component) Returns an object that represents a service provided by the Component or by its Container.
protected methodMemberwiseClone (inherited from Object) Creates a shallow copy of the current Object.
protected methodOnContinue When implemented in a derived class, OnContinue runs when a Continue command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service resumes normal functioning after being paused.
protected methodOnCustomCommand When implemented in a derived class, OnCustomCommand executes when the Service Control Manager (SCM) passes a custom command to the service. Specifies actions to take when a command with the specified parameter value occurs.
protected methodOnPause When implemented in a derived class, executes when a Pause command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service pauses.
protected methodOnPowerEvent When implemented in a derived class, executes when the computer's power status has changed. This applies to laptop computers when they go into suspended mode, which is not the same as a system shutdown.
protected methodOnShutdown When implemented in a derived class, executes when the system is shutting down. Specifies what should happen immediately prior to the system shutting down.
protected methodOnStart When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.
protected methodOnStop When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.

See Also

ServiceBase Class | System.ServiceProcess Namespace

Show: