簡體   English   中英

Windows服務時遇到錯誤1053

[英]Facing Error 1053 in case of windows service

我做了一個Windows服務。 我的代碼類似於:

onstart()
{
    while(true)
    {
        //code
    }
}

我正在嘗試每分鍾更新我的數據庫。 該服務正確構建並正確安裝,但是當我啟動該服務時,它給出錯誤1053。我已經嘗試了很多方法來解決它,但沒有任何解決方案。

protected override void OnStart(string[] args)
{
    //put debugger.launch the first statement of OnStart...and make sure you running in    debug mode
    Debugger.Launch();

    try
    {

      //your code
      . 
      .
      .
    }
    catch(Exception ex)
    {
        //see what exception is coming
    }


}

您定義了onStop嗎?

ServiceBase類直接從Advapi32.dll文件的ScDispatcherLoop中定義的Service命令處理程序調用OnStop方法。 30秒后,如果ScDispatcherLoop線程尚未准備好從服務控制管理器接收新的服務命令,則Windows Service Controller會將服務標記為“超時”。 因此,您收到此錯誤信息。 -微軟

轉到服務器的控制台(如果需要,請在服務器機房中)並啟動Window Service。 遠程輸入將無法使用。

暫無
暫無

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

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