<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      把Windows應用程序應用程序exe做成windows服務

      將Windows應用程序應用程序exe做成windows服務

      問題:

      sc命令注冊exe為服務時顯示失敗,提示代碼1053,如何解決?

      使用SC命令將EXE文件注冊為Windows服務時,如果遇到錯誤代碼1053(“服務沒有及時響應啟動或控制請求"),通常是因為目標程序未按Windows服務的標準實現。

      具體原因可能包括:

      程序未包含服務入口點(ServiceMain函數)、

      未正確處理服務控制管理器的通信,或者啟動超時。

      解決方法如下:

      1.確保EXE是專門設計為Windows服務的程序。

      2.如果是普通應用程序,可借助工具如

      'nssm'(Non-Sucking Service Manager) 將其包裝為服務。

      3.檢查服務配置參數是否正確,特別是啟動路徑和依賴項。

      4. 增加服務啟動超時時間:通過注冊表鍵

      'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control下的‘ServicesPipeTimeout 值進行調整。

      cmd執行如下命令:

      reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control" /v ServicesPipeTimeout /t REG_DWORD /d 60000 /f

      5. 以管理員權限運行

      CMD井重新執行SC命。

      6、 如果用SC命令不能刪除服務,可以從注冊表里刪除。

      reg delete HKLM/SYSTEM/CurrentControlSet/Services/ServiceName 

      示例命:

      sc create MyService binPath= "C\path\tolyour.exe" start= auto

      1、使用windows自帶的命令sc

      首先我們要打開cmd,下面的命令在cmd中運行,最好使用管理員運行cmd

      1、注冊服務:

      sc create demo服務 binpath= D:\demo服務\demo服務.exe type= own start= auto displayname= demo服務

      介紹參數

      binpath:你的應用程序所在的路徑。

      displayname:服務顯示的名稱

      sc config 服務名 start= demand //手動

      sc condig 服務名 start= auto //自動

      sc config 服務名 start= disabled //禁用

      當你使用sc create命令創建一個服務時,如果沒有指定type參數,它通常會默認為Own Process類型。這是最安全的配置,因為它隔離了服務,減少了潛在的風險,如果一個服務崩潰,不會影響到其他服務

       

      2、啟動服務

      net start demo服務1

      3、停止服務

      net stop demo服務1

      4、刪除服務

      sc delete "demo服務"

      2、InstallUtil 操作 Windows Service

      要安裝windows service 首先要找到 InstallUtil.exe,InstallUtil.exe位置在 C:\Windows\Microsoft.NET\Framework\v4.0.30319,用什么版本寫的服務,找到對應版本,各個版本不同詳見(C:\Windows\Microsoft.NET\Framework\版本)

      然后使用命令

      安裝服務

      InstallUtil.exe 服務路徑/windowsServiceName.exe

      快捷安裝:直接找到對應的 installutil.exe,拖cmd中,再拖你服務的位置路徑下的服務名稱.exe,(win10 以上系統支持)

      啟動該服務

      net start windowsServiceName

      停止服務

      net stop windowsServiceName

      卸載服務

      InstallUtil.exe /u 服務路徑/windowsServiceName.exe

      3、NSSM install Windows Service

      nssm install MyService "C:\path\to\your.exe"

      NSSM和WinSW把exe注冊成服務,

      sc可以操作服務 sc query xx服務名字

      NSSM下載地址:http://www.nssm.cc/ http://www.nssm.cc/release/nssm-2.24.zip

      WinSW下載地址:https://github.com/winsw/winsw/releases

      4、WinSW把exe注冊成服務

      NSSM和WinSW把exe注冊成服務,sc可以操作服務 sc query xx服務名字

      NSSM下載地址:http://www.nssm.cc/http://www.nssm.cc/release/nssm-2.24.zip

      WinSW下載地址:https://github.com/winsw/winsw/releases

      1、根據需要注冊的系統,64系統使用WinSW-x64.exe或者32系統使用WinSW-x86.exe

      2、復制WinSW-x64.exe或者WinSW-x86.exe到需要注冊的目錄,把名稱修改為需要注冊的名字(名字隨意)

      3、例如:nginx.exe 需要注冊到服務中(64系統使用WinSW-x64.exe)

      1、修改WinSW-x64.exe為nginxService.exe

      2、修改sample-minimal.xml為nginxService.xml(nginxService.exe與nginxService.xml必須同一目錄)

      3、nginxService.xml中內容如下

      4、在nginxService.exe當前目錄中進入cmd ,執行nginxService.exe install,服務中就有了

      nginxService.xml中內容如下

      <service>
      <!-- ID of the service. It should be unique across the Windows system-->
      <id>nginxService123</id>
      <!-- Display name of the service -->
      <name>nginxService</name>
      <!-- Service description -->
      <description>nginx服務的描述</description>
      <executable>nginx.exe</executable>
      </service>

       

      java注冊666.jar注冊到服務,有參數

      例如:jar需要注冊到服務中(64系統使用WinSW-x64.exe)

      1、修改WinSW-x64.exe為javaService.exe

      2、修改sample-minimal.xml為javaService.xml(java.exe與javaService.xml必須同一目錄)

      3、javaService.xml中內容如下

      4、在javaService.exe當前目錄中進入cmd ,執行javaService.exe install,服務中就有了

      javaService.xml中內容如下

      <service>
      <!-- ID of the service. It should be unique across the Windows system-->
      <id>javaService123</id>
      <!-- Display name of the service -->
      <name>javaService</name>
      <!-- Service description -->
      <description>jar服務的描述</description>
      <executable>java</executable>
      <arguments> -jar 666.jar</arguments>
      </service>

       

       參考鏈接:https://blog.csdn.net/qq_74271133/article/details/139483670

      posted @ 2025-06-13 15:20  龍騎科技  閱讀(330)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 久久精品国产免费观看频道| 69精品丰满人妻无码视频a片| 午夜福利片1000无码免费| 亚洲国产精品一二三四五| 一区二区三区不卡国产| 1000部拍拍拍18勿入免费视频下载| 国产成人一区二区免av| 国产在线国偷精品免费看| 人人入人人爱| 狠狠色丁香婷婷综合尤物| 国产精品一区二区三区黄色| 美女一区二区三区在线观看视频 | 亚洲AV无码久久精品成人| 成人国产精品一区二区网站公司 | 天堂а√8在线最新版在线| 91精品久久一区二区三区| 中文字幕国产精品综合| 大名县| 国产女高清在线看免费观看| 翘臀少妇被扒开屁股日出水爆乳| 色偷偷偷久久伊人大杳蕉| 亚洲精品久久麻豆蜜桃| 亚洲午夜亚洲精品国产成人| 亚洲国产制服丝袜先锋| 亚洲热线99精品视频| 亚洲午夜爱爱香蕉片| 无套内射极品少妇chinese| 色综合天天综合网天天看片 | 杂多县| 人妻熟女一二三区夜夜爱| 欧美一本大道香蕉综合视频| 国产午夜福利免费入口| 高清美女视频一区二区三区| 唐人社导航福利精品| 欧美色丁香| 精品久久人人妻人人做精品| 不卡一区二区国产在线| 无码毛片一区二区本码视频| 久久月本道色综合久久| 99久久亚洲综合精品成人网| 洛阳市|