Windows Service stops after running for a couple of days RRS feed

  • Question

  • I wrote a simple windows service program in .Net 2.0 (VS2005) along with a serviceprocess installer. After install of the service, service is manually started with startuptype as Automatic and running under LocalSystem account. The service downloads files from a sftp server and updates an application's datbase. The problem is that the service runs fine for a couple of days (6-10) and suddenly stops without giving me sufficient error messages. Most of my clients were in XP/ Windows Server 2003/ Windows Vista where I did not get much error log info.  When i installed in Windows 7 and had the same issue of service stopping i could see this eventlog.

    Date:          20/12/2010 3:08:23 PM
    Event ID:      0
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      <<ComputerName>>
    Service cannot be started. The service process could not connect to the service controller
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
        <Provider Name="ApplicationName" />
        <EventID Qualifiers="0">0</EventID>
        <TimeCreated SystemTime="2010-12-20T05:08:23.000Z" />
        <Security />
        <Data>Service cannot be started. The service process could not connect to the service controller</Data>

    Any ideas..?
    Wednesday, February 2, 2011 6:32 AM


  • You may surround main logic of Start method with try...catch… block, and log the exception detail to eventlog or disk files, from which you can find more information about this issue.
    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eryang Monday, February 14, 2011 8:55 AM
    Tuesday, February 8, 2011 6:37 AM