Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error 1067 C# windows service

Error 1067 C# windows service

Scheduled Pinned Locked Moved C#
helpcsharpsysadminwindows-adminquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eyesark
    wrote on last edited by
    #1

    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

    P L J P 4 Replies Last reply
    0
    • E eyesark

      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

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Does msglgc get initialized to null? Does it keep running? And shouldn't the Stop method set it back to null?

      1 Reply Last reply
      0
      • E eyesark

        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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • E eyesark

          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

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • E eyesark

            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

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups