static void Main(string[] args) { //Debug2(); //Console.Write("Done Debug"); //Console.Read(); //return; LOG.Write("Radiopaedia Upload Agent"); LOG.Write("Created by Andy Le of The Royal Melbourne Hospital"); LOG.Write("Built: " + LOG.RetrieveLinkerTimestamp().ToString("dd MMMM yyyy | HH:mm:ss")); //LOG.Write("Press 'ctrl+c' to quit."); try { HostFactory.Run(x => { x.Service <ServiceController>(s => { s.ConstructUsing(name => new ServiceController()); s.WhenStarted(nc => nc.Start()); s.WhenStopped(nc => nc.Stop()); }); x.RunAsLocalSystem(); x.SetDescription("Radiopaedia Uploader Agent"); x.SetDisplayName("Radiopaedia Uploader Agent"); x.SetServiceName("Radiopaedia Uploader Agent"); }); } catch (Exception ex) { LOG.Write(ex.Message); LOG.Write(Newtonsoft.Json.JsonConvert.SerializeObject(ex)); } }
public void Start() { LOG.Write("Radiopaedia Upload Agent"); LOG.Write("Created by Andy Le of The Royal Melbourne Hospital"); LOG.Write("Built: " + LOG.RetrieveLinkerTimestamp().ToString("dd MMMM yyyy | HH:mm:ss")); LOG.Write("Service Started"); var sl = new ServiceLoop(); System.Threading.Thread listenerCaller = new System.Threading.Thread(new System.Threading.ThreadStart(sl.StartHttp)); listenerCaller.Start(); }