In C# you can do like this :
private void KillService()
{
Process serviceProcess = null;
try
{
serviceProcess = Process.GetCurrentProcess();
if(null != serviceProcess)
{
serviceProcess.Kill();
}
}
catch
{
}
}
call this function in onStop with a delay timer