使用winsw发布接口服务

使用winsw发布接口服务

该方法同时适用于Springboot项目和.netCore项目

参考:https://zhuanlan.zhihu.com/p/453733074

1.下载 winsw

下载地址: https://github.com/winsw/winsw

同时包括.exe和.xml文件,其中.xml为配置文件,.exe为执行文件,两个文件名称必须一致

2.配置服务信息

1).netcore 项目

<service>
<!--服务ID-->
  <id>DataService</id>
  <!--系统服务名称-->
  <name>DataService</name>  
  <!--系统服务名称-->
  <description>DataService</description>
  
  <executable>dotnet</executable>
  <arguments>E:\prj\code\CSharp\SW\IntelligentTrack\DataService\bin\Debug\net6.0\DataService.dll</arguments>
   <!--开机自启-->
  <startmode>Automatic</startmode>
   <!--保存日志-->
  <log mode="append">
  <logpath>filelog.log</logpath>
  </log>
  
</service>

2).SpringBoot项目

<service>
<!--服务ID-->
  <id>yy</id>
  <!--系统服务名称-->
  <name>yy</name>  
  <!--系统服务名称-->
  <description>计算服务</description>
  
  <executable>java</executable>
  <arguments>-jar yy-0.0.1-SNAPSHOT.jar</arguments>
   <!--开机自启-->
  <startmode>Automatic</startmode>
   <!--保存日志-->
  <log mode="append">
  <logpath>filelog.log</logpath>
  </log>
  
</service>

3.安装服务

apiServer.exe install

除install之外,还有如下命令:

  • uninstall:删除服务
  • start:启动服务
  • stop:停止服务
  • restart:重启服务
  • status:查看状态

安装成功后可以在系统服务中查看到服务信息,可以自定义服务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值