同一Windows服务的多个实例 [英] Multiple instance of same windows service

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

问题描述



我创建了一个可以在单个实例上正常运行的Windows服务.我们有一个要求,基于用户输入,如果用户输入为2,则应在同一台计算机上安装2个相同Windows服务的实例.为此,我使用以下ProjectInstaller.cs中的代码创建服务实例.

Hi,

I have created a windows service which runs fine as a single instance.We have a requirement that based on the user input say if the user input is 2, 2 instances of the same windows service should be installed on the same machine. To achieve this I''m creating instances of the service using this the below code in ProjectInstaller.cs

for (int i = 1; i <;= 2; i++)
{
  this.Installers.Add(GetServiceInstaller(i));
  this.Installers.Add(GetServiceProcessInstaller());
}



现在我可以创建多个实例,我已经覆盖了注册表路径以引用新创建的实例文件夹.创建了同一服务的2个实例.现在一切正常,除非我尝试启动该服务,否则抛出该错误.老化错误错误1083:此服务配置为在其中运行的可执行程序未实现该服务".谁能建议我要采取其他措施来避免此错误.或者还有其他更好的方法来解决这个问题.

问候,
Anandhi



Now I''m able to create multiple instances ,i had overwritten the registry path to refer the newly created instance folders.2 instances of the same service are created.Now everything went fine, except when i try to start the service its throwing the age old error "Error 1083: The executable program that this service is configured to run in does not implement the service". Can anyone suggest me what else needs to be done to avoid this error.Or is there any other better way to handle this.

Regards,
Anandhi

推荐答案

尝试以下链接..


多实例.NET Windows服务 [ http://social.msdn.microsoft.com/论坛/en-US/netfxbcl/thread/6618e8bd-0d56-4d31-800a-ba002bfe78bb [
Try following links..


Multiple Instance .NET Windows Service[^]

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/6618e8bd-0d56-4d31-800a-ba002bfe78bb[^]

Hope this will help!


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

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