簡體   English   中英

如何在Windows對話框中更新服務狀態

[英]How Do I Update the Status of Service in the Windows Dialog

如何更新Windows服務對話框中的“ Status列?

  • 當服務進入(托管)故障狀態時...我想更新對話框

在此處輸入圖片說明

我不想回答我自己的問題,但是沒人回答這個問題。

不幸的是,由於它的結果是只讀,因此您無法直接更新“ Status字段。 但是,您可以暫停服務,如下所示:

var serviceController = new ServiceController(ServiceName);
serviceController.Pause();      // Pauses the service
serviceController.Refresh();    // Refreshes the Dialog UI with the new Status

這是不幸的,因為沒有“真正”的方式來顯示服務的故障狀態。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM