美文网首页
使用WINSW工具在window下以服务方式启动

使用WINSW工具在window下以服务方式启动

作者: brightranger | 来源:发表于2021-05-22 10:10 被阅读0次

下载winsw

到Github release这里就可以下载winsw了。我用的是WinSW.NET461.exe,下载下来后放在项目目录下,将名字改为和项目名一样。


image.png

xml配置

我们需要编写一个和程序同名的XML文件作为winsw的配置文件。
文件大体上长这样,这是官网的例子。可自行更改

<service>
      <id>jenkins</id>
      <name>Jenkins</name>
      <description>This service runs Jenkins continuous integration system.</description>
      <env name="JENKINS_HOME" value="%BASE%"/>
      <executable>java</executable>
      <arguments>-Xrs -Xmx256m -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>
      <logmode>rotate</logmode>
</service>

启动服务

编写好配置文件之后,记得把配置文件和可执行文件放在一起,
然后我们在项目下打开命令提示符,使用下面的命令进行安装

项目名.exe install

相关文章

网友评论

      本文标题:使用WINSW工具在window下以服务方式启动

      本文链接:https://www.haomeiwen.com/subject/xmsnjltx.html