ServiceController.ServiceName Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the name that identifies the service that this instance references.
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
Property Value
The name that identifies the service that this ServiceController instance references. The default is an empty string ("").
- Attributes
Exceptions
The ServiceName is null
.
The syntax of the ServiceName property is invalid.
The service was not found.
Remarks
The ServiceName 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 ServiceName is usually set in the main()
function of the executable.
When you reset the ServiceName property, the method that sets the property sets this instance's DisplayName to an empty string ("").
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示