.NET Framework Developer Center > .NET Development Forums > 64-Bit .NET Framework Development. > Win (.NET) service fails on Windows Server 2008 x64
Ask a questionAsk a question
 

AnswerWin (.NET) service fails on Windows Server 2008 x64

  • Tuesday, October 13, 2009 11:48 AMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi All,

    We have windows service (.NET 2) which works fine on Windows Server 2000 and Windows Server 2003 x32/x64. But it fails on Windows Server 2008 x64. No errors, no exceptions - it simply stops (it starts and it works for some (random) time) working.
    Any suggestions?

Answers

  • Wednesday, October 14, 2009 3:08 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello gloomman

    This looks a typical "slient process exit" problem: Process terminates unexpectedly without user knowledge and without any actionable trace. This kind of issues are generally difficult to debug. Windows 7 introduces a powerful capability to trouble-shoot silent process exit:
    http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/07d82a0e-a85a-44a0-825d-493a2c49db1a
    but the function is not available in Windows Server 2008 x64 under discussion.

    The typical causes of "silent process exit" are:

    1. custom exception filters that swallows the exception and terminates the process.
    2. C++ unhandled exceptions (Fixed in VS2005 and later Visual Studios)
    3. COM swalows exceptions across boundaries, application may run in corrupted state
    4. application bugs resulting in unexpected process termination.

    For terminations due to unahndled exceptions, you can attach a debugger to the service process to find out the exception. The KB http://support.microsoft.com/kb/824344 introduces how to debug a windows service. If you cannot install any debugger on the server machine, you can remote debug: http://support.microsoft.com/kb/824344

    For termination due to Termiation APIs:
    TerminateProcess,
    ExitProcess,
    TermiateThread on the last therad,
    ExitThread on the last thread
    You can set a breakpoint on these functions, and when your debugger breaks on the calls, check the current call stack to see who's the caller.

    As I said previously, trouble-shooting slient process exit is generally difficult. Please follow the above suggestions, and let me know if you have any questions.

    Regards,
    Jialiang Ge
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

All Replies

  • Tuesday, October 13, 2009 1:15 PMStephen Cleary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Check the event log; top-level exceptions for services get written there.

           -Steve
    Programming blog: http://nitoprograms.blogspot.com/
      Including my TCP/IP .NET Sockets FAQ

    Microsoft Certified Professional Developer
  • Tuesday, October 13, 2009 2:35 PMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Check the event log; top-level exceptions for services get written there.
    Nothing specific there (at that moment i'm unable to provide you with exact message (i have no access to the server), but there is some generic message, like "service stopped").
  • Tuesday, October 13, 2009 3:21 PMStephen Cleary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That sounds like a normal shutdown. i.e., something else told the service to stop, and that's why it stopped.

           -Steve
    Programming blog: http://nitoprograms.blogspot.com/
      Including my TCP/IP .NET Sockets FAQ

    Microsoft Certified Professional Developer
  • Wednesday, October 14, 2009 3:08 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hello gloomman

    This looks a typical "slient process exit" problem: Process terminates unexpectedly without user knowledge and without any actionable trace. This kind of issues are generally difficult to debug. Windows 7 introduces a powerful capability to trouble-shoot silent process exit:
    http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/07d82a0e-a85a-44a0-825d-493a2c49db1a
    but the function is not available in Windows Server 2008 x64 under discussion.

    The typical causes of "silent process exit" are:

    1. custom exception filters that swallows the exception and terminates the process.
    2. C++ unhandled exceptions (Fixed in VS2005 and later Visual Studios)
    3. COM swalows exceptions across boundaries, application may run in corrupted state
    4. application bugs resulting in unexpected process termination.

    For terminations due to unahndled exceptions, you can attach a debugger to the service process to find out the exception. The KB http://support.microsoft.com/kb/824344 introduces how to debug a windows service. If you cannot install any debugger on the server machine, you can remote debug: http://support.microsoft.com/kb/824344

    For termination due to Termiation APIs:
    TerminateProcess,
    ExitProcess,
    TermiateThread on the last therad,
    ExitThread on the last thread
    You can set a breakpoint on these functions, and when your debugger breaks on the calls, check the current call stack to see who's the caller.

    As I said previously, trouble-shooting slient process exit is generally difficult. Please follow the above suggestions, and let me know if you have any questions.

    Regards,
    Jialiang Ge
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, October 14, 2009 1:03 PMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello gloomman

    This looks a typical "slient process exit" problem: Process terminates unexpectedly without user knowledge and without any actionable trace.
    Thank you a lot, Jialiang. I'll check issues you have mentioned.

  • Thursday, October 15, 2009 10:05 AMCaptain Kernel Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello gloomman

    This looks a typical "slient process exit" problem: Process terminates unexpectedly without user knowledge and without any actionable trace.
    Thank you a lot, Jialiang. I'll check issues you have mentioned.


    It may be helpful to see if the problem also happens on Windows 7, if it does, then the new Silent Process Exit feature may shed light on the cause. In other words, you may be able to use Windows 7 as a tool to help you fix the bug on Server 2008.

    Cap'n
  • Friday, October 16, 2009 5:12 PMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It may be helpful to see if the problem also happens on Windows 7, if it does, then the new Silent Process Exit feature may shed light on the cause. In other words, you may be able to use Windows 7 as a tool to help you fix the bug on Server 2008.

    Cap'n

    Unfortunately, it's not possible at that moment.
  • Saturday, October 17, 2009 10:01 AMCaptain Kernel Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It may be helpful to see if the problem also happens on Windows 7, if it does, then the new Silent Process Exit feature may shed light on the cause. In other words, you may be able to use Windows 7 as a tool to help you fix the bug on Server 2008.

    Cap'n

    Unfortunately, it's not possible at that moment.

    OK in that case, consider using a vectored exception handler, or AppDomain.UnhandledException event.

    Cap'n


  • Friday, October 23, 2009 6:26 AMJialiang Ge [MSFT]MSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello

    How are you? Could you please update me about your findings?

    Thanks
    Jialiang Ge
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, October 27, 2009 3:49 PMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    OK in that case, consider using a vectored exception handler, or AppDomain.UnhandledException event.

    Already done, but not deployed (tested) yet.


    Regards, Denis
  • Tuesday, October 27, 2009 3:54 PMgloomman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello

    How are you? Could you please update me about your findings?

    Hi,
    No news at that moment. I am waiting for response from our testers and IT guys... I'll make an update to this post as soon as i get any results.


    Regards, Denis