ServiceInstaller.Description 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 description for the service.
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
Property Value
The description of the service. The default is an empty string ("").
- Attributes
Examples
The following code example sets the installation properties for a new Windows service application. The example sets the service name, along with the display name and description. After assigning the installation properties for the service, the example adds the ServiceInstaller object to the Installers collection.
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
Remarks
Use the Description property to describe the purpose of the installed service to the user. The user can view the service description in applications that display details for installed services.
For example, using Windows XP, you can view the service description with the Service Control command-line utility (Sc.exe) or you can view the service description within the Services node of the Computer Management console.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기