如何同时启动和停止多个组件?
我有一个由 3 个主要组件(后台进程、数据库、UI)组成的应用程序。现在我想立即启动和停止所有组件。
这些应用程序将作为最终用户的应用程序。这意味着停止进程的入口点是 UI 应用程序。目前我确实有两个想法如何实现这一点:
- 从 UI 启动和停止后台进程和数据库。
- 通过脚本启动和停止一切。
我现在还缺少其他解决方案吗?或者更好 - 对于这样的要求有任何最佳实践吗?
一些附加信息:
- 后台进程是用 C++ 编写的
- UI 是用 C# 编写的 - WPF
- 数据库作为 Windows 服务运行
I have an application which consists of 3 main components (Background process, database, UI). Now I want to start and stop all components at once.
The apps will be served as an application to endusers. That means that the entrypoint for stopping the process has the be the UI application. Currently I do have two ideas how I could implement this:
- Start and stop background process and database from the UI.
- Start and stop everything by a script.
Are there other solutions that I´m missing right now? Or better - are there any best practices for such a requirement?
Some additional information:
- Background process is written in C++
- UI is written in C# - WPF
- Database runs as Windows service
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信在完全相同的时间停止它们并不是一件容易的事,即使您创建一个线程来处理这个停止过程(这将是尝试同时停止它们的“最接近”的方式)。
答案实际上取决于几个方面:
I believe it's not quite easy to stop them in the exact same time, even if you create one thread that would take care of this stopping process (which would be the "closest" way attempting to stop them in the same time).
The answer actually depends on a couple of aspects: