static void Main(string[] args) { EvsServiceHost.StartService(); System.Console.WriteLine("Press <Enter> to exit"); System.Console.ReadLine(); EvsServiceHost.StopService(); }
protected override void OnStart(string[] args) { base.OnStart(args); // // Use temp directory to redirect Console.Out and Console.Error. // string tempPath = Path.GetTempPath(); string eventMessage; this.EventLog.WriteEntry("OnStart", System.Diagnostics.EventLogEntryType.Information); if (args.Length > 0) { eventMessage = string.Format( System.Globalization.CultureInfo.InvariantCulture, "Service OnStart Arguments:{0}: ", args); EventLog.WriteEntry(eventMessage, System.Diagnostics.EventLogEntryType.Information); } eventMessage = string.Format( System.Globalization.CultureInfo.InvariantCulture, "BaseDirectory:{0}", System.AppDomain.CurrentDomain.BaseDirectory); EventLog.WriteEntry(eventMessage, System.Diagnostics.EventLogEntryType.Information); eventMessage = string.Format( System.Globalization.CultureInfo.InvariantCulture, "CurrentDirectory:{0}", System.Environment.CurrentDirectory); EventLog.WriteEntry(eventMessage, System.Diagnostics.EventLogEntryType.Information); eventMessage = string.Format( System.Globalization.CultureInfo.InvariantCulture, "TempPath:{0}", tempPath); EventLog.WriteEntry(eventMessage, System.Diagnostics.EventLogEntryType.Information); // start the EVS Web Service EvsServiceHost.StartService(); }