出现的问题:服务无法启动
解决方法:需要用以下配置方式将启动和停止参数分成多行。
1、配置frp启动服务
<service>
<!-- 该服务的唯一标识 -->
<id>frp</id>
<!-- 该服务的名称 -->
<name>frp</name>
<!-- 该服务的描述 -->
<description>frpc客户端 这个服务用 frpc 实现内网穿透</description>
<!-- 要运行的程序路径 -->
<executable>C:\Tools\frp\frpc.exe</executable>
<!-- 携带的参数 -->
<startargument>-c</startargument>
<startargument>C:\Tools\frp\frpc.ini</startargument>
<!-- 第一次启动失败 60秒重启 -->
<onfailure action="restart" delay="60 sec"/>
<!-- 第二次启动失败 120秒后重启 -->
<onfailure action="restart" delay="120 sec"/>
<!-- 日志模式 -->
<logmode>append</logmode>
<!-- 指定日志文件目录(相对于executable配置的路径) -->
<logpath>logs</logpath>
</service>
2、正常启动事件日志(可以去windows的事件管理器查看)
//正常启动事件日志
Starting C:\Tools\frp\frpc.exe -c C:\Tools\frp\frpc.ini
//正常停止事件日志
Child process [13588 - C:\Tools\frp\frpc.exe -c C:\Tools\frp\frpc.ini ] terminated with 2
3、winsw命令(需要管理员cmd去目录执行)
//注册服务
winsw.exe install
//卸载服务
winsw.exe uninstall
//启动服务
winsw.exe start
//停止服务
winsw.exe stop
//重启服务
winsw.exe restart
//查看状态
winsw.exe status