Error 1067 C# windows service
-
I was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below: i was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below:
\[RunInstaller(true)\] public partial class MessagingInstaller : Installer { public MessagingInstaller() { InitializeComponent(); } } public partial class MessagingService : ServiceBase { //declare the message sending logic private MessagingLogic msglgc; //private readonly EventLog \_log = new EventLog { Source = "MessageLogger" }; public MessagingService() { InitializeComponent(); } //create new instance of the message sending logic and/or start service protected override void OnStart(string\[\] args) { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc == null) msglgc = new MessagingLogic(); msglgc.Start(); } catch (ArgumentException exception) { \_log.WriteEntry("OnStart Error: " + exception.Message); } } //stop the service protected override void OnStop() { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc != null) msglgc.Stop(); } catch (ThreadAbortException exception) { \_log.WriteEntry("OnStop Error: " + exception.Message); } } }
Please help! I need the solution as soon as possible
-
I was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below: i was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below:
\[RunInstaller(true)\] public partial class MessagingInstaller : Installer { public MessagingInstaller() { InitializeComponent(); } } public partial class MessagingService : ServiceBase { //declare the message sending logic private MessagingLogic msglgc; //private readonly EventLog \_log = new EventLog { Source = "MessageLogger" }; public MessagingService() { InitializeComponent(); } //create new instance of the message sending logic and/or start service protected override void OnStart(string\[\] args) { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc == null) msglgc = new MessagingLogic(); msglgc.Start(); } catch (ArgumentException exception) { \_log.WriteEntry("OnStart Error: " + exception.Message); } } //stop the service protected override void OnStop() { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc != null) msglgc.Stop(); } catch (ThreadAbortException exception) { \_log.WriteEntry("OnStop Error: " + exception.Message); } } }
Please help! I need the solution as soon as possible
Does
msglgc
get initialized tonull
? Does it keep running? And shouldn't theStop
method set it back tonull
? -
I was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below: i was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below:
\[RunInstaller(true)\] public partial class MessagingInstaller : Installer { public MessagingInstaller() { InitializeComponent(); } } public partial class MessagingService : ServiceBase { //declare the message sending logic private MessagingLogic msglgc; //private readonly EventLog \_log = new EventLog { Source = "MessageLogger" }; public MessagingService() { InitializeComponent(); } //create new instance of the message sending logic and/or start service protected override void OnStart(string\[\] args) { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc == null) msglgc = new MessagingLogic(); msglgc.Start(); } catch (ArgumentException exception) { \_log.WriteEntry("OnStart Error: " + exception.Message); } } //stop the service protected override void OnStop() { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc != null) msglgc.Stop(); } catch (ThreadAbortException exception) { \_log.WriteEntry("OnStop Error: " + exception.Message); } } }
Please help! I need the solution as soon as possible
Does the new log get created, do you see any messages, normal or exception ...? Try and gather some more information about exactly where it is failing.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
I was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below: i was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below:
\[RunInstaller(true)\] public partial class MessagingInstaller : Installer { public MessagingInstaller() { InitializeComponent(); } } public partial class MessagingService : ServiceBase { //declare the message sending logic private MessagingLogic msglgc; //private readonly EventLog \_log = new EventLog { Source = "MessageLogger" }; public MessagingService() { InitializeComponent(); } //create new instance of the message sending logic and/or start service protected override void OnStart(string\[\] args) { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc == null) msglgc = new MessagingLogic(); msglgc.Start(); } catch (ArgumentException exception) { \_log.WriteEntry("OnStart Error: " + exception.Message); } } //stop the service protected override void OnStop() { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc != null) msglgc.Stop(); } catch (ThreadAbortException exception) { \_log.WriteEntry("OnStop Error: " + exception.Message); } } }
Please help! I need the solution as soon as possible
eyesark wrote:
Please help!
You are assuming that only one possible exception can occur in OnStart. However if any exception occurs in there then windows will think that the service didn't start. You can look at System.ServiceProcess.ServiceBase.AutoLog. If set to true, before any real processing then if OnStart exits with an exception then an event log entry will be written with the exception stack trace.
-
I was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below: i was doing a C# windows service. the service installs and runs well on my machine, but when i deploy on server (Windows server 2003), and try to start it, i get the dreaded 'Error 1067: application terminated unexpectedly'! What to do? some of the code is shown below:
\[RunInstaller(true)\] public partial class MessagingInstaller : Installer { public MessagingInstaller() { InitializeComponent(); } } public partial class MessagingService : ServiceBase { //declare the message sending logic private MessagingLogic msglgc; //private readonly EventLog \_log = new EventLog { Source = "MessageLogger" }; public MessagingService() { InitializeComponent(); } //create new instance of the message sending logic and/or start service protected override void OnStart(string\[\] args) { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc == null) msglgc = new MessagingLogic(); msglgc.Start(); } catch (ArgumentException exception) { \_log.WriteEntry("OnStart Error: " + exception.Message); } } //stop the service protected override void OnStop() { if (!EventLog.SourceExists("MessageLogger")) EventLog.CreateEventSource("MessageLogger", "Event Logger"); var \_log = new EventLog { Source = "MessageLogger" }; try { if (msglgc != null) msglgc.Stop(); } catch (ThreadAbortException exception) { \_log.WriteEntry("OnStop Error: " + exception.Message); } } }
Please help! I need the solution as soon as possible
I suspect that the problem is to do with registering the event source. If you don't have enough privileges to do this, the application will abort at the point you are trying to do this because you are creating it outside of the try/catch block.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility