zoukankan      html  css  js  c++  java
  • C#编写windows服务,多服务为什么只启动一个(ServiceBase.Run)

    https://zhidao.baidu.com/question/380395667.html

    //多服务一个宿主程序时必须注间以下要点: 

     Service1的ServiceName 必须 Installer1.Designer.cs 中的 serviceInstaller1.ServiceName 完全一致

    //this.ServiceName MUST match this.serviceInstaller1.ServiceName in Installer1.Designer.cs file 

    //this.ServiceName MUST match this.serviceInstaller2.ServiceName in Installer1.Designer.cs file

    //this.ServiceName MUST match this.serviceInstaller3.ServiceName in Installer1.Designer.cs file

    //serviceInstaller1中的代码

    //this.serviceInstaller1.ServiceName = "Win32MultiServices1"; 

    //Service1中的代码

    //this.ServiceName = "Win32MultiServices1"

    2.ServiceName已经一样 还是只能启动一个

    代码对比,少了一个Installer,不是主要原因

      this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller1,
                this.serviceInstaller1});
    this.Installers.AddRange(new System.Configuration.Install.Installer[] {
                this.serviceProcessInstaller1,
                this.serviceInstaller1,
                this.serviceInstaller2});

    1.改变显示名称,描述

    2.删除所有Installer重新添加

  • 相关阅读:
    2019nc#7
    ABC133F
    2019DX#6
    2019DX#5
    2019dx#4
    解决一般图最大匹配——带花树算法
    2019nc#4
    B-generator 1_2019牛客暑期多校训练营(第五场)
    hdu-6638 Snowy Smile
    hdu-6621 K-th Closest Distance
  • 原文地址:https://www.cnblogs.com/xdot/p/6259876.html
Copyright © 2011-2022 走看看