I was faced with the same problem last year and I wrestled with a lot of the same questions. A few bits of advice:
Since either service may be updated, both services will function as updaters of the other. Service A will update Service B and vice versa. For this reason, I suggest simply running both services at all times. Unless you are worried about really loading down your server with does-update-exist calls, the enable/disable service management isn't worth the overhead.
Like services can't be installed on a single machine. In other words, you can't install new and old versions of the service side-by-side if they have the same name. Unless you want to complicate your update process, I suggest you uninstall the old version and then install the new version. For example, Service A would download Service B Installer, uninstall Service B, install new version of Service B and then run. Service B would do the same for Service A.
Since each service is managing the other, they should not only check for available updates but they should verify each other's health. For example, Service A would check to see if Service B exists and if it is running. If the health check fails, a list of steps to resolve the issue and get the service running would be completed by Service A. Executing the health check and recovery operations will cover you now matter what issue arises with the update, initial install or general operations.
Do ample logging on both the client and the server. You'll want to track what actions were taken and when. For example, Service A might when it is checking for updates, when it is executing the health check and associated actions. On the service (assuming you are calling into a web service looking for updates) track the calls made by each Service. If your Services aren't getting updated at least you'll have a trail of breadcrumbs (or lack of breadcrumbs) pointing you to the problem.
There are literally bunches of potential gotchas with a solution of this sort: services not running at startup, UAC getting in the way, not being able to install and uninstall the services with the same user, ensuring user installing the service has ample permissions, connectivity loss, getting the .NET Framework installed on the client machine, handling reboot after install if necessary, etc.
Best of luck. It's a fun problem to solve, but it doesn't go without it's frustration -- especially since, as you said, there isn't a lot of documented information available.
发布评论
评论(1)
去年我也遇到过同样的问题,我也曾思考过很多同样的问题。 一些建议:
由于任一服务都可能会更新,
这两项服务都将充当
对方的更新者。 服务A将
更新服务 B,反之亦然。 为了
由于这个原因,我建议简单地运行
任何时候都提供这两种服务。 除非
你担心是否真的加载
关闭你的服务器
does-update-exist 调用,
启用/禁用服务管理
不值得花费这些开销。
类似的服务无法安装在
单机。 换句话说,你
无法安装新旧版本
并排服务(如果有)
同名。 除非你要
使您的更新过程复杂化,我
建议您卸载旧版本
然后安装新版本。
例如,服务 A 将下载
服务B安装程序、卸载
服务B,安装新版本
然后运行服务B。 服务B
会对服务 A 执行相同的操作。
由于每个服务都在管理
其他,他们不应该只检查
可用的更新,但他们应该
核实彼此的健康状况。 为了
例如,服务 A 会检查
如果服务 B 存在并且如果是
跑步。 如果健康检查失败,
解决问题的步骤列表
并让服务运行起来
由服务 A 完成。执行
健康检查和恢复操作
无论什么问题,现在都会为您解答
随着更新而出现,初始
安装或一般操作。
在客户端上进行充分的日志记录
和服务器。 你会想要追踪
采取了什么行动以及何时采取的。
例如,服务 A 可能会在
正在检查更新,当它是
执行健康检查并
相关的行动。 关于服务
(假设您正在调用网络
服务寻找更新)跟踪
每个服务发出的调用。 如果
您的服务没有更新
至少你会有一条踪迹
面包屑(或缺少面包屑)
指出问题所在。
这种解决方案实际上存在很多潜在的问题:服务在启动时不运行、UAC 妨碍、无法使用同一用户安装和卸载服务、确保安装服务的用户拥有足够的权限、连接丢失、在客户端计算机上安装 .NET Framework、在必要时处理安装后重新启动等。
祝您好运。 这是一个解决起来很有趣的问题,但它也伴随着挫败感——特别是因为,正如你所说,没有太多可用的记录信息。
I was faced with the same problem last year and I wrestled with a lot of the same questions. A few bits of advice:
Since either service may be updated,
both services will function as
updaters of the other. Service A will
update Service B and vice versa. For
this reason, I suggest simply running
both services at all times. Unless
you are worried about really loading
down your server with
does-update-exist calls, the
enable/disable service management
isn't worth the overhead.
Like services can't be installed on a
single machine. In other words, you
can't install new and old versions of
the service side-by-side if they have
the same name. Unless you want to
complicate your update process, I
suggest you uninstall the old version
and then install the new version.
For example, Service A would download
Service B Installer, uninstall
Service B, install new version of
Service B and then run. Service B
would do the same for Service A.
Since each service is managing the
other, they should not only check for
available updates but they should
verify each other's health. For
example, Service A would check to see
if Service B exists and if it is
running. If the health check fails,
a list of steps to resolve the issue
and get the service running would be
completed by Service A. Executing the
health check and recovery operations
will cover you now matter what issue
arises with the update, initial
install or general operations.
Do ample logging on both the client
and the server. You'll want to track
what actions were taken and when.
For example, Service A might when it
is checking for updates, when it is
executing the health check and
associated actions. On the service
(assuming you are calling into a web
service looking for updates) track
the calls made by each Service. If
your Services aren't getting updated
at least you'll have a trail of
breadcrumbs (or lack of breadcrumbs)
pointing you to the problem.
There are literally bunches of potential gotchas with a solution of this sort: services not running at startup, UAC getting in the way, not being able to install and uninstall the services with the same user, ensuring user installing the service has ample permissions, connectivity loss, getting the .NET Framework installed on the client machine, handling reboot after install if necessary, etc.
Best of luck. It's a fun problem to solve, but it doesn't go without it's frustration -- especially since, as you said, there isn't a lot of documented information available.