How do I code a Mono Daemon(如何编写 Mono 守护程序)
问题描述
我正在尝试为 linux 编写 Mono C# 守护程序.
I'm trying to write a Mono C# daemon for linux.
我想在它完成处理时启动和停止它,而不是仅仅终止进程.
I'd like to do a starts and stops of it when its done processing instead of just killing the process.
有人有这方面的例子吗?
Does anyone have any examples of this?
我想出了如何在 debian 中使用 start-stop-daemon --background,所以我想我现在就使用它.
I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that for now.
我也在 java 中实现这个,他们有这个很好的 addShutdownHook 可以捕获终止应用程序.我需要花更多的时间来整理单声道服务的依赖关系,或者找到一种方法来捕获应用程序终止.
I'm implementing this in java as well and they have this nice addShutdownHook that catches terminating the app. I need to spend a little more time sorting out the dependencies for mono service, or find a way to catch app termination.
有 SessionEnd 事件,但这仅适用于服务而不是控制台应用程序
There is the SessionEnd event, but thats only available for services and not console apps
答案:在linux上使用mono-service包装一个windows服务
推荐答案
你应该实现一个服务并使用单服务.谷歌一下,你会发现几个例子.
You should implement a service and use mono-service. Google for it and you'll find several examples.
这篇关于如何编写 Mono 守护程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何编写 Mono 守护程序


基础教程推荐
- 如何激活MC67中的红灯 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01