ServiceInstaller.Description プロパティ

定義

サービスの説明を取得または設定します。

public:
 property System::String ^ Description { System::String ^ get(); void set(System::String ^ value); };
[System.Runtime.InteropServices.ComVisible(false)]
[System.ServiceProcess.ServiceProcessDescription("ServiceInstallerDescription")]
public string Description { get; set; }
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.ServiceProcess.ServiceProcessDescription("ServiceInstallerDescription")>]
member this.Description : string with get, set
Public Property Description As String

プロパティ値

String

サービスの説明。 既定値は、空の文字列 ("") です。

属性

次のコード例では、新しいWindows サービス アプリケーションのインストール プロパティを設定します。 この例では、表示名と説明と共にサービス名を設定します。 サービスのインストール プロパティを割り当てた後、この例ではオブジェクトを ServiceInstaller コレクションに Installers 追加します。

simpleServiceProcessInstaller = new ServiceProcessInstaller();
simpleServiceInstaller = new ServiceInstaller();

// Set the account properties for the service process.
simpleServiceProcessInstaller.Account = ServiceAccount.LocalService;

// Set the installation properties for the service.
// The ServiceInstaller.ServiceName must match the
// ServiceBase.ServiceName set in the service
// implementation that is installed by this installer.
simpleServiceInstaller.ServiceName = "SimpleService";

simpleServiceInstaller.DisplayName = "Simple Service";
simpleServiceInstaller.Description = "A simple service that runs on the local computer.";
simpleServiceInstaller.StartType = ServiceStartMode.Manual;

// Add the installers to the Installer collection.
Installers.Add(simpleServiceInstaller);
Installers.Add(simpleServiceProcessInstaller);
' Start the service.
Protected Overrides Sub OnStart(ByVal args() As String) 
    ' Start a separate thread that does the actual work.
    If workerThread Is Nothing OrElse(workerThread.ThreadState And System.Threading.ThreadState.Unstarted Or System.Threading.ThreadState.Stopped) <> 0 Then
        Trace.WriteLine(DateTime.Now.ToLongTimeString() + " - Starting the service worker thread.", "OnStart")
        
        workerThread = New Thread(New ThreadStart(AddressOf ServiceWorkerMethod))
        workerThread.Start()
    End If
    If Not (workerThread Is Nothing) Then
        Trace.WriteLine(DateTime.Now.ToLongTimeString() + " - Worker thread state = " + workerThread.ThreadState.ToString(), "OnStart")
    End If

End Sub

注釈

このプロパティを Description 使用して、インストールされているサービスの目的をユーザーに説明します。 ユーザーは、インストールされているサービスの詳細を表示するアプリケーションでサービスの説明を表示できます。

たとえば、Windows XP を使用すると、サービス制御コマンド ライン ユーティリティ (Sc.exe) を使用してサービスの説明を表示したり、コンピューター管理 コンソールの [サービス] ノード内でサービスの説明を表示したりできます。

適用対象

こちらもご覧ください