• 以windows服务发布jar包 以windows服务发布 dotnetcore dll


    winsw

    本文基于开源工具 winsw 以windows服务启动jar包 或者 dotnetcore dll 或者exe

    https://github.com/kohsuke/winsw/releases

    官方原始Start文档

    Use WinSW as a bundled tool 使用WinSW作为捆绑工具

    In order to setup WinSW, you commonly need to perform the following steps:

    1. Take WinSW.exe from the distribution, and rename it to your taste (such as myapp.exe)
    2. Write myapp.xml (see the XML config file specification for more details)
    3. Place those two files side by side, because that's how WinSW discovers its configuration.
    4. Run myapp.exe install [options] to install the service.
    5. Run myapp.exe start to start the service.

    There are some details for each step available below.

    可以去网站下载 WinSW.NET461.exe,如果电脑没有安装.NetFramework,可以直接下载dotnetcore版本

    示例1:

    需要运行Nop.Web.dll

    将下载下来的WinSW.NET461.exe修改为名称 nopcommerce.exe

    然后添加一样名称的配置文件nopcommerce.xml

    <service>
        <id>nopcommerce</id>
        <name>nopcommerce</name>
        <description>This is nopcommerce service.</description>
        <executable>dotnet</executable>
        <arguments>Nop.Web.dll --urls=http://localhost:15536</arguments>
        <startmode>Automatic</startmode>
        <logmode>roll</logmode>
        <logpath>log</logpath>
    </service>
    

    示例2:

    需要运行pigx-auth.jar

    将下载下来的WinSW.NET461.exe修改为名称 pigx-auth.exe样名称的配置文件pigx-auth.xml

    `

    <service>
        <id>pigx-auth</id> #id
        <name>pigx-auth</name> #名称或者简称
        <description>This is pigx-auth service.</description> #windows服务名称
        <executable>java</executable> #可执行文件
        <arguments>-Dfile.encoding=utf-8 -jar %BASE%/pigx-auth.jar</arguments> #参数 %BASE% 表示pigx-auth所在目录
        <startmode>Automatic</startmode> #自动启动
        <logmode>roll</logmode> #移动到*.old
        <logpath>log</logpath> #日志目录 nopcommerce.err.log nopcommerce.out.log nopcommerce.wrapper.log
    </service>
    

    常用命令

    myapp.exe stop

    myapp.exe uninstall

    myapp.exe restart

  • 相关阅读:
    可持续化线段树(主席树)
    2016-06-19 NOIP模拟赛
    0618图的整理
    1536 海战
    1005 生日礼物
    3280 easyfinding
    2594 解药还是毒药
    2919 选择题
    1845 二叉查找树
    1174 靶形数独
  • 原文地址:https://www.cnblogs.com/herenwei-wayne/p/14136395.html
Copyright © 2020-2023  润新知