I am trying to create a service in JScript and am confused. I have two
files, SimpleService.JS and SimpleServiceInstaller.JS as follows:

SimpleService.JS
/---------------------------------------------------------------------------
--
import System;
import System.ServiceProcess;
import System.Diagnostics;
import System.Timers;

class SimpleService extends ServiceBase
{
private var timer : Timer = null;

function SimpleService()
{
this.CanPauseAndContinue = true;
this.ServiceName = "SimpleService";
this.timer = new Timer();
this.timer.Interval = 1000;
this.timer.add_Elapsed(OnTimer);
}

protected override function OnStart(args : String[])
{
EventLog.WriteEntry("Simple Service started");
this.timer.Enabled = true;
}

protected override function OnStop()
{
EventLog.WriteEntry("Simple Service stopped");
this.timer.Enabled = false;
}

protected override function OnPause()
{
EventLog.WriteEntry("Simple Service paused");
this.timer.Enabled = false;
}

protected override function OnContinue()
{
EventLog.WriteEntry("Simple Service continued");
this.timer.Enabled = true;
}

function OnTimer(source : Object, e : ElapsedEventArgs)
{
EventLog.WriteEntry("Hello World from SimpleService!");
}
}

ServiceBase.Run(new SimpleService());

/---------------------------------------------------------------------------
--

and SimpleServiceInstaller.JS
/---------------------------------------------------------------------------
--
import System;
import System.Collections;
import System.ComponentModel;
import System.Configuration.Install;
import System.ServiceProcess;

public RunInstallerAttribute(true) class SimpleServiceInstaller extends
Installer
{
private var serviceInstaller : ServiceInstaller = null;
private var serviceProcessInstaller : ServiceProcessInstaller = null;

public function SimpleServiceInstaller()
{
serviceInstaller = new ServiceInstaller();
serviceInstaller.ServiceName = "SimpleService";
serviceInstaller.DisplayName = "Simple Service";
serviceInstaller.StartType = ServiceStartMode.Manual;
this.Installers.Add(serviceInstaller);

serviceProcessInstaller = new ServiceProcessInstaller();
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
this.Installers.Add(serviceProcessInstaller);
}
}
/---------------------------------------------------------------------------
--

I compiled both of them in the following manner:
jsc /t:exe SimpleService.js
and
jsc /t:exe SimpleServiceInstaller.js

And then installed the installer with:
installutil SimpleServiceInstaller.exe

On examining the Services.MMC, I see the service "SimpleService" in there
but whenever I attempt to start the service I get the dialog "Could not
start the Simple Service service on Local Computer, Error 1053: ..."!

Can someone please tell me what am I doing wrong and how do I fix it?

Thanks,

Harjit S. Batra