public void DoWork() { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; ITV2ADI_Controller _Controller = new ITV2ADI_Controller(); Thread thread = new Thread(_Controller.WF_Start); thread.Start(_Controller); Thread.Sleep(0); }
protected override void OnStart(string[] args) { try { System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory); _Controller = new ITV2ADI_Controller(); thread = new Thread(_Controller.WF_Start); thread.Start(_Controller); base.OnStart(args); } catch (Exception OSEx) { log.Error($"Error starting the service please check permissions or configuration parameters, Message: {OSEx.Message}"); log.Error($"StackTrace: {OSEx.StackTrace}"); OnStop(); } }