Thread: error stop a Windows service

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    error stop a Windows service

    Hello everyone,


    Here is my OnStop method of Windows service application. When click stop, the error message is, "Error: 1067 The process terminated unexpectedly".

    I have tested if remove the Join method, the service can stop gracefully. Does it mean Join method is not allowed to be called in OnStop method of a Windows service? Any ideas?

    Code:
    protected override void OnStop()
    {
        MyWorkerThread.Join();
        this.ExitCode = 0;
    }

    thanks in advance,
    George

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    How about putting your code in a try-catch-block ? Then you can see what goes wrong.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows Messenger service.
    By myk_raniu in forum Networking/Device Communication
    Replies: 1
    Last Post: 02-25-2006, 05:00 AM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. writing a windows service
    By talz13 in forum Windows Programming
    Replies: 2
    Last Post: 07-01-2004, 06:32 AM
  4. windows service + hooks + dll
    By rotis23 in forum Windows Programming
    Replies: 5
    Last Post: 09-04-2003, 07:06 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM