ServiceController.ServiceName Propriété

Définition

Obtient ou définit le nom qui identifie le service référencé par cette instance.

public:
 property System::String ^ ServiceName { System::String ^ get(); void set(System::String ^ value); };
public:
 property System::String ^ ServiceName { System::String ^ get(); };
public string ServiceName { get; set; }
public string ServiceName { get; }
[System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))]
[System.ServiceProcess.ServiceProcessDescription("SPServiceName")]
public string ServiceName { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))]
[System.ServiceProcess.ServiceProcessDescription("SPServiceName")]
[System.ComponentModel.SettingsBindable(true)]
public string ServiceName { get; set; }
member this.ServiceName : string with get, set
member this.ServiceName : string
[<System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))>]
[<System.ServiceProcess.ServiceProcessDescription("SPServiceName")>]
member this.ServiceName : string with get, set
[<System.ComponentModel.TypeConverter(typeof(System.ServiceProcess.Design.ServiceNameConverter))>]
[<System.ServiceProcess.ServiceProcessDescription("SPServiceName")>]
[<System.ComponentModel.SettingsBindable(true)>]
member this.ServiceName : string with get, set
Public Property ServiceName As String
Public ReadOnly Property ServiceName As String

Valeur de propriété

String

Nom qui identifie le service référencé par l'instance de ServiceController. La valeur par défaut est une chaîne vide ("").

Attributs

Exceptions

La syntaxe de la propriété ServiceName n'est pas valide.

Le service est introuvable.

Remarques

Le ServiceName service identifie le service au Gestionnaire de contrôle de service. La modification de cette propriété entraîne la liaison de l’instance ServiceController à un autre service, elle ne change pas ce que le composant logiciel enfichable Microsoft Management Console de Service Control Manager affiche.

Lorsque vous implémentez un service personnalisé, la valeur de cette propriété doit être identique au nom enregistré pour le service dans la propriété de la ServiceName classe correspondante ServiceInstaller . Dans le code, il ServiceName est généralement défini dans la main() fonction de l’exécutable.

Lorsque vous réinitialisez la ServiceName propriété, la méthode qui définit la propriété définit les valeurs de cette instance DisplayName sur une chaîne vide ( » « ).

S’applique à