locked
Windows Server 2012 (Custom Windows Service) RRS feed

  • Question

  • Hi There

    We have a custom windows service, it installs correctly on the server using (installutil.exe).

    When it runs via (task scheduler) on the server it does not start and gives error below in the event viewer :

    “Service cannot be started. The service process could not connect to the service controller”

    i have tried everything in this post below but does not work , i get same error above:

    https://stackoverflow.com/questions/4216606/why-cant-i-install-my-service-runtime-newer-than-loaded-runtime/4217077#4217077

    Any help would be appreciated.

    Thank You and stay safe

    Kind Regards
    Thursday, August 13, 2020 8:35 AM

All replies

  • Hi Zunaid,

    Did you create the Service based on .Net framework or Win32?

    For .Net framework, did you follow these official documents: Walkthrough: Create a Windows Service App (Install the service, Start and run the service) to create, install, start and run the service? I suggest you try to start the service by opening Services desktop app > press Windows + R > enter services.msc > press Enter > search and find your service listed in Services > choose Start from the service’s shortcut menu > Check if your service starts successfully. After that, please remember to check the user account.(This can exclude the issues of the service itself)

    For Win32, did you follow this document: The Complete Service Sample to test the service?

    Besides, did you set the appropriate account permissions to use the task scheduler?

    Feel free to contact me.

    Best Regards,

    Tianyu


    Visual Studio forum is being migrated to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Visual Studio" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.


    Friday, August 14, 2020 3:25 AM
  • Hi Tianyu

    Thank You for your reply.

    We are still having the issue as we followed your recommendations as below.

    Its is a  .Net framework based service 

    I did follow the steps below as you mentioned:

    For .Net framework, did you follow these official documents: Walkthrough: Create a Windows Service App (Install the serviceStart and run the service) to create, install, start and run the service? 

    We have also set correct account as you recommended below :

    we are using an application account we created in AD and given it all necessary permissions on the database and in AD.

    Besides, did you set the appropriate account permissions to use the task scheduler?

    Thank you

    Wednesday, August 19, 2020 10:07 AM
  • A Windows Service cannot be directly started as a scheduled task in the same manner as an ordinary executable program (.exe).

    However, you can work around this by using a scheduled task to run a program that can start a windows service.  For example, a scheduled task can run the command "C:\Windows\System32\sc.exe start YourService".



    Wednesday, August 19, 2020 11:55 AM