Windows 服务 - 是否建议在运行时更新其配置文件? [英] Windows Services - Is it advisable to update its config file while running?

查看:27
本文介绍了Windows 服务 - 是否建议在运行时更新其配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的标题,我想澄清一下:是否建议在 .Net Windows 服务运行时更新配置文件?

As per my title, I would like to clarify: Is it advisable to update the config file while a .Net windows service is running?

如果可能的话,它的含义是什么?

What would be its implications, if this is possible?

谢谢.

干杯,安

推荐答案

这里还有其他出色的答案,但您要问什么?您是在询问正在编写的服务吗?或者关于其他人的服务.

There are other excellent answers here, but what are you asking? Are you asking about a service that you are writing? Or about someone else's Service.

如果它是关于您要编写的服务,那么不,更改时不会自动重新加载 .config 文件.您要么必须:

If it is about a service you are going to write, then no, there is no automatic reload of the .config file when it is changed. You will either have to:

  1. 重新启动服务以查看更改.
  2. 编写您的服务以使用 FileSystemWatcher 查看配置文件是否已更改,然后决定要对已更改的任何或所有值执行什么操作.

如果是关于别人的服务,你需要根据上面的描述询问他们它是如何工作的.

If it is about someone else's service, you will need to ask them how it works based upon the above description.

这篇关于Windows 服务 - 是否建议在运行时更新其配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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