private void OnElapsedEvent(object sender, ElapsedEventArgs e) { //throw new NotImplementedException(); try { localhostwsjson.wsjson serviceObj = new localhostwsjson.wsjson(); //string svcM1 = serviceObj.HelloWorld(); //WriteToFile("output m1 " + svcM1+" at "+ DateTime.Now.ToString()); serviceObj.DoNothing(); WriteToFile("method op parsed successfully"); } catch { WriteToFile("Connection to web service failed!"); WriteToFile("Last Attempt at " + DateTime.Now.ToString()); } }
protected override void OnStart(string[] args) { WriteToFile("Service started at " + DateTime.Now.ToString()); try { localhostwsjson.wsjson serviceObj = new localhostwsjson.wsjson(); //string svcM1 = serviceObj.HelloWorld(); //WriteToFile("output m1 " + svcM1); serviceObj.DoNothing(); WriteToFile("Do nothing from on start:ok "); } catch { WriteToFile("Connection to web service failed"); } timer.Interval = 10000; timer.Elapsed += OnElapsedEvent; timer.Enabled = true; timer.AutoReset = true; }