c# - 如何推迟关闭 Windows 服务

标签 c#

我有一个用 c# 编写的服务,使用 System.Net.WebClient 将消息发送到一个永恒的 API。

如何推迟关闭以确保在用户关闭服务之前返回我的消息结果?

最佳答案

How can I make sure my message is result is return before the service can be shutdown by user?

你不能。

考虑远程系统是否运行缓慢:是否应该无限期延迟关闭?

然后考虑如果断电(或其他硬件故障)会发生什么:系统关闭,根本没有机会完全关闭。

如果你有单点硬件故障,你就没有任何可靠性。

关于c# - 如何推迟关闭 Windows 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32711121/

相关文章:

c# - 如何在 DataTrigger 中使用预定义样式

c# - c# lambdas 只存在于编译时吗?

c# - 如何打开备用 Web 浏览器(Mozilla 或 Firefox)并显示特定 URL?

c# - 如何在 ASP.NET MVC 和 jQuery 中根据下拉列表选择添加额外的部分 View ?

c# 使用 SET 有什么意义?

c# - 使用子目录设置 ASP Net Core 应用程序

c# - 静态东西的松散耦合

c# - 'TestController.Post()' : not all code paths return a value

c# - 无法找到该资源。 MVC4

c# - 如何使用 MongoDb .net 驱动程序获取集合中所有文档的几个特定字段