同一Windows服务应用程序的两个实例 [英] Two instances of the same Windows Service application

查看:89
本文介绍了同一Windows服务应用程序的两个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些简单的方法来使用相同的VS解决方案/项目文件来构建同一Service应用程序的两个实例,这些实例将在单个计算机上分别安装和运行?我目前的解决方案"是创建ProjectA并 都实例化具有所有所需功能的MainClass的ProjectB,但是现在该应用需要从MainClass中自动关闭...感谢任何想法.

Is there some straight-forward way to use the same VS solution/project files to build two instances of the same Service application that will install and run separately on a single computer?  My present "solution" is to create ProjectA and ProjectB that both instantiate a MainClass with all the desired functionality, but now the app needs to self-shutdown from the MainClass... Thanks in advance for any ideas.

推荐答案

是否存在一些简单的方法来使用相同的VS解决方案/项目文件来构建同一Service应用程序的两个实例,这些实例将在单个计算机上分别安装和运行?我目前的解决方案"是创建ProjectA 和ProjectB都实例化具有所有所需功能的MainClass,但是现在该应用需要自行从MainClass中自动关闭...感谢任何想法.
Is there some straight-forward way to use the same VS solution/project files to build two instances of the same Service application that will install and run separately on a single computer?  My present "solution" is to create ProjectA and ProjectB that both instantiate a MainClass with all the desired functionality, but now the app needs to self-shutdown from the MainClass... Thanks in advance for any ideas.

我不明白.

您可以在一个解决方案中安装任意数量的项目.这些项目中的两个可以相同,只要* .projx位于不同的文件夹中即可.他们甚至可以共享相同的源代码.但是,它们之一只能在任何时间处于活动状态. 因此可以肯定,您可以构建两个基本相同的项目.

You can install as many projects as you want in a single solution. Two of those projects can be identical, as long as the *.projx are in different folders. They can even share the same source code. However, only one of them can be active at any one time. So certainly you can build two projects that are essentially the same.

我不知道您所说的从MainClass中自动关机"是什么意思.您需要澄清您的意思.当然,您可以在特定条件下退出程序.在这种情况下,您在说什么条件?

I have no clue what you mean by "self-shutdown from the MainClass". You need to clarify what you mean by this. Certainly you can have a program exit under specific conditions. What conditions are you talking about in this case?


这篇关于同一Windows服务应用程序的两个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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