更新Windows服务的过程?是自动的还是手动的? [英] Process for updating a windows service? Automated or is it manual?

查看:24
本文介绍了更新Windows服务的过程?是自动的还是手动的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在服务器上有 Windows 服务,更新服务的最佳实践"是什么?(假设其中存在错误,或者我需要为其添加更多功能).

If I have a windows service on a server, what is 'best practise' for updating the service? (say there was a bug in it, or I need to ad more features to it).

有没有一种方法可以关闭服务、修补它并以更自动化的方式启动和运行它?

Is there a way I could shutdown the service, patch it and get it up and running in a more automated way?

(任何带有代码的链接都会很棒)

(any links with code would be great)

推荐答案

取决于您的服务是如何编写的 - 单体 EXE - 您需要使用选择的进程停止并重新启动它,例如安装程序、脚本 + 服务控制、批处理和 NET STOP/START 等.

Depends how your service is written - monolith EXE - you'll need to stop and restart it using a process of choice e.g. Installer, Script + Service Control, batch and NET STOP/START etc.

如果你的结构有点不同,例如引导 EXE 将您的服务实现加载为可以卸载/重新加载的模块,然后您可以进行不同的对话.这当然要复杂得多.

If you structure it a little differently e.g. bootstrap EXE loading your service implementation as modules that can be unloaded/reloaded then you can have a different conversation. This is of course a quite a bit more complicated.

我在 C# 中使用这样的托管解决方案取得了一些成功,这里有类似的对话:

I've had some success in C# with a hosting solution like this, similar conversation here:

我希望我的 C# Windows 服务能够自动更新自身

这篇关于更新Windows服务的过程?是自动的还是手动的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆