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 守护程序


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01