ServiceInstaller.Description Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur deskripsi untuk layanan.
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
Nilai Properti
Penjabaran dari layanan. Defaultnya adalah string kosong ("").
- Atribut
Contoh
Contoh kode berikut mengatur properti penginstalan untuk aplikasi layanan Windows baru. Contoh mengatur nama layanan, bersama dengan nama tampilan dan deskripsi. Setelah menetapkan properti penginstalan untuk layanan, contoh menambahkan ServiceInstaller objek ke Installers koleksi.
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
Keterangan
Description Gunakan properti untuk menjelaskan tujuan layanan yang diinstal kepada pengguna. Pengguna dapat melihat deskripsi layanan dalam aplikasi yang menampilkan detail untuk layanan yang diinstal.
Misalnya, menggunakan Windows XP, Anda dapat melihat deskripsi layanan dengan utilitas baris perintah Kontrol Layanan (Sc.exe) atau Anda dapat melihat deskripsi layanan dalam simpul Layanan konsol Manajemen Komputer .