chr
2024-10-09 1f645778ae80a3a8801b8bb4d0fcf8feb244ad43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using log4net.Config;
using System;
using System.IO;
using System.Reflection;
using System.ServiceProcess;
 
namespace PluginListener
{
    public class Program
    { /// <summary>
      /// 应用程序的主入口点。
      /// </summary>
        [STAThread]
        public static void Main()
        {
            string assemblyFilePath = Assembly.GetExecutingAssembly().Location;
            string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath);
            string configFilePath = Path.Combine(assemblyDirPath,"log4net.config");
            XmlConfigurator.Configure(new FileInfo(configFilePath));
 
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new Listener()
            };
            ServiceBase.Run(ServicesToRun);
        }
    }
}
 
// sc create "SolidWorks Listener" binpath= "D:\Workspace\PdmSwPlugin2\PdmSw\bin\x64\Debug\Listener\PluginListener.exe" type= interact type= own displayname= "SolidWorks Listener"