Gets or sets the name that identifies the service that this instance references.
Assembly: System.ServiceProcess (in System.ServiceProcess.dll)
'Declaration <ServiceProcessDescriptionAttribute("SPServiceName")> _ Public Property ServiceName As String 'Usage Dim instance As ServiceController Dim value As String value = instance.ServiceName instance.ServiceName = value
The identifies the service to the Service Control Manager. Changing this property causes the ServiceController instance to bind to another service, it does not change what the Service Control Manager's Microsoft Management Console snap-in displays.
When you are implementing a custom service, the value of this property must be identical to the name recorded for the service in the ServiceName property of the corresponding ServiceInstaller class. In code, the is usually set in the main() function of the executable.
When you reset the property, the method that sets the property sets this instance's DisplayName to an empty string ("").
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.