Windows Service Wrapper
This project creates a wrapper executable that can be used to host any executable as an Windows service.
Download
The binaries are available here for download.
Usage
During your development...
- Take
winsw.exe
from the distribution, and rename it to your taste (such asmyapp.exe
) - Write
myapp.xml
(see Configuration Syntax for more details) - Place those two files side by side when you deploy your application, because that's how
winsw.exe
discovers its configuration.
At runtime...
- To install a service, run
myapp.exe install
- To start a service, run
myapp.exe start
- To stop a service, run
myapp.exe stop
- To restart a service, run
myapp.exe restart
- To uninstall a service, run
myapp.exe uninstall
When there's a problem, these commands also report an error message to stderr. On a successful completion, these commands do no produce any output and exit with 0.
In addition, you can also run myapp.exe status
to have it print out the current status of the service to stdout. Again, any error encountered during the processing would cause output to be reported to stderr.
All these commands use the same set of exit code to indicate its result.
Deferred File Operations
To support self updating services, winsw offers a mechanism to perform file operations before a service start up. This is often necessary because Windows prevents files from overwritten while it's in use.
To perform file operations, write a text file (in the UTF-8 encoding) at myapp.copies
(that is, it's in the same directory asmyapp.xml
but with a different file extension), and for each operation add one line:
- To move a file, write "src>dst". If the 'dst' file already exists it will be overwritten.
The success or failure of these operations will be recorded in the event log.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2014-03-20 web开发的一些总结
2014-03-20 web 纯 javascript 的MVC 实现的简单实践