简体   繁体   English

如何一起部署多个应用程序

[英]How to deploy multiple applications together

I have the following: 我有以下几点:

  1. Windows service that I wrote, it is used only by the two following apps: 我编写的Windows服务,仅由以下两个应用程序使用:
  2. Client app. 客户端应用。
  3. Agent app. 代理应用。

Both client and agent can't function without the service. 没有服务,客户端和代理都无法运行。 Our current installation is using ClickOnce (the service is not yet deployed). 我们当前的安装正在使用ClickOnce (该服务尚未部署)。

What I want: 我想要的是:

  1. 2 separate installations - client+service, agent+service. 2个单独的安装-客户端+服务,代理+服务。 This is because I have many machines that will only perform tasks that clients send them, and they don't need the client. 这是因为我有很多机器仅执行客户端发送给他们的任务,而它们不需要客户端。 Also, not everyone who wants a client wants to make his machine an agent as well. 同样,并不是每个想要客户的人都希望使他的机器也成为代理。
  2. Deploy logical packages - it doesn't make sense to deploy only client, for example, because it can't run by itself. 部署逻辑程序包-仅部署客户端没有意义,例如,因为它本身无法运行。 It also doesn't make sense to deploy the service by itself. 单独部署服务也没有意义。
  3. Maintain versions compatibility - How to handle the following scenario: someone installed agent+service version 1, then installed client+service version 2. 维护版本兼容性-如何处理以下情况:先安装代理+服务版本1,然后再安装客户端+服务版本2。
  4. Elevated privileges: is it possible to install windows service on a machine using an account that has elevated privileges, but the current privileges aren't necessarily elevated? 特权提升:是否可以使用具有特权提升的帐户在计算机上安装Windows服务,但是当前特权不一定必须提升? Can I make a silent installation? 我可以进行静默安装吗?

ClickOnce is very nice but not mandatory. ClickOnce非常好,但不是强制性的。 If there are better solutions to meet my requirements, I will switch to them, providing that update is still possible (force update as well as an option to delay update). 如果有更好的解决方案可以满足我的要求,我将切换到它们,前提是仍然可以进行更新(强制更新以及延迟更新的选项)。

I'll address the ClickOnce approach. 我将介绍ClickOnce方法。 An msi install might be more appropriate, but it sounds as though you want some sort of auto-updating. 安装msi可能更合适,但听起来好像您想要某种自动更新。 It might be easier to force your windows service install into a ClickOnce approach rather than make an msi install self-updating. 将Windows服务强制安装为ClickOnce方法可能比使msi安装进行自我更新更容易。

ClickOnce, at its core, is simple. ClickOnce的核心很简单。 It keeps files in a user's profile folder in sync with files on a server. 它可以使用户配置文件文件夹中的文件与服务器上的文件保持同步。 This should work great for the Client and Agent apps. 这对于客户端和代理应用程序应该非常有用。 Not so much for the windows service. Windows服务不多。

For the service I would have ClickOnce deploy the service bits. 对于服务,我将让ClickOnce部署服务位。 Then write code that will execute in the Client/Agent to install/update the service. 然后编写将在客户端/代理中执行的代码以安装/更新服务。

I've found Topshelf to be pure awesome when working with services. 我发现Topshelf在使用服务时确实很棒。 It lets you write a standard console app which makes development easier. 它使您可以编写标准的控制台应用程序,从而使开发更加轻松。 Then to install it you can call the console exe and pass an --install switch. 然后要安装它,您可以调用控制台exe并传递--install开关。 I think you could have that code execute whenever the Client/Agent starts and copy files, install/update/start/stop the service, and whatever else is necessary to make your service work. 我认为,只要客户端/代理启动并复制文件,安装/更新/启动/停止服务以及使服务正常工作所需的任何其他操作,您就可以执行该代码。

Now for your numbered list... 现在为您的编号清单...

  1. Can be handled. 可以处理。 Two ClickOnce installs both containing the service. 两个ClickOnce将同时安装包含该服务的两个。
  2. This should work as long as you can install the service through your own code. 只要您可以通过自己的代码安装该服务,它就应该起作用。
  3. This is more tricky. 这比较棘手。 You have to define what you want to happen. 您必须定义要发生的事情。 You would be in complete control of the code that installs the service, so you can decide what to do and handle it appropriately. 您将完全控制安装服务的代码,因此您可以决定要做什么并适当地处理它。
  4. I'm guessing you'll need elevated privileges to get the windows service installed. 我猜想您需要提升的特权才能安装Windows服务。 That means a prompt from ClickOnce. 这意味着来自ClickOnce的提示。 The only way around that is to sign your deployments then import the certificate on the client's machine. 唯一的解决方法是对您的部署进​​行签名,然后将证书导入客户端计算机上。 Not really worth it to avoid one prompt, IMHO. 避免一次提示不是很值得,恕我直言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM