Exemplo n.º 1
0
        /// <summary>
        /// When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.
        /// </summary>
        /// <param name="args">Data passed by the start command.</param>
        protected override void OnStart(string[] args)
        {
            MiddlewareInstance intance = new MiddlewareInstance();

            intance.StartWorking();

            this.log.Info("Windows service started.");
        }
Exemplo n.º 2
0
 /// <summary>
 /// Mains the specified arguments.
 /// </summary>
 /// <param name="args">The arguments.</param>
 static void Main(string[] args)
 {
     if (!Environment.UserInteractive)
     {
         ServiceBase[] ServicesToRun;
         ServicesToRun = new ServiceBase[]
         {
             new WindowsService()
         };
         ServiceBase.Run(ServicesToRun);
     }
     else
     {
         MiddlewareInstance intance = new MiddlewareInstance();
         intance.StartWorking();
         Console.ReadKey();
     }
 }