不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
VS2008 Windows服务在安装程序上删除再添加无法安装
编辑:dnawo 日期:2009-03-20

如上图示,在安装程序上有多个Windows服务,将serviceInstaller2、serviceInstaller3删除后再添加,编译、安装,你会发现再也没办法成功安装这两个服务了,后来将前后的文件进行比较,发现问题主要在ProjectInstaller.Designer.cs上,下边列出了修改前后的代码,注意红色部分。
修改前:
复制内容到剪贴板
程序代码

private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller2 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller3 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "Service1";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller2
//
this.serviceInstaller2.ServiceName = "Service2";
this.serviceInstaller2.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller3
//
this.serviceInstaller3.ServiceName = "Service3";
this.serviceInstaller3.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1,
this.serviceInstaller2,
this.serviceInstaller3});
}
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller2 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller3 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "Service1";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller2
//
this.serviceInstaller2.ServiceName = "Service2";
this.serviceInstaller2.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller3
//
this.serviceInstaller3.ServiceName = "Service3";
this.serviceInstaller3.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1,
this.serviceInstaller2,
this.serviceInstaller3});
}
修改后:
复制内容到剪贴板
程序代码

private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller2 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller3 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "Service1";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller2
//
this.serviceInstaller2.ServiceName = "Service2";
this.serviceInstaller2.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller3
//
this.serviceInstaller3.ServiceName = "Service3";
this.serviceInstaller3.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller2 = new System.ServiceProcess.ServiceInstaller();
this.serviceInstaller3 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "Service1";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller2
//
this.serviceInstaller2.ServiceName = "Service2";
this.serviceInstaller2.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// serviceInstaller3
//
this.serviceInstaller3.ServiceName = "Service3";
this.serviceInstaller3.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}






评论: 0 | 引用: 0 | 查看次数: 5501
发表评论
请登录后再发表评论!