protected override void OnStart(string[] args) { base.OnStart(args); DateTime dt = DateTime.Now; string filePath = string.Format ("{0}{1}.txt" ,"D:/swathi/","startFile"); StreamWriter sw = new StreamWriter(filePath); sw.Write("service opened at"); sw.WriteLine(dt); sw.Close(); } protected override void OnStop() { DateTime dt = DateTime.Now; string filePath = string.Format("{0}{1}.txt", "D:/swathi/", "closeFile"); StreamWriter sw = new StreamWriter(filePath); sw.Write("Service closed at"); sw.WriteLine(dt); sw.Close(); base.OnStop(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)