CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    [RESOLVED] Windows Service starting "too fast"

    Hi guys,

    I created a Windows Service that uses MySQL. But this week I noticed that after a server reboot, I get a few MySQL Exceptions after the services is started: 'Unable to open connection to "MySQL, MySQL provider 6.2.20". Unable to connect to any of the specified MySQL hosts.'

    It looks like that my service is started before the MySQL service. Is there any way to prevent this? Or can't there be anything done about it and should I just ignore the errors...

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Windows Service starting "too fast"

    Windows services allow you to set dependent services. The SCM will ensure that these services are started before starting your service.

    In your project installer, open the ServiceInstaller properties and set the ServicesDependsOn property.

    The example below shows a service that depends on the Message Queue service.
    Attached Images Attached Images  

  3. #3
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: Windows Service starting "too fast"

    Great!

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured