Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have a rpc server and client which just prints a simple message. I have made a service using the server exe file(using sc create) which when running prints the message "The service did not respond to the start or control request in a timely fashion". I also tried increasing the timeout period so its just showing the same error. So how to solve this?
Posted
Updated 18-Aug-15 2:17am
v2
Comments
sreeyush sudhakaran 18-Aug-15 7:39am    
Is it C++ or C# , this may happen due to delay caused in RPC calls , you can call service control manager APIs to kill the service from program if it is not responding for a long time.

The "Start" event of your service needs to finish its work and complete within a set time, normally 90 seconds I think. Same with your Stop event.

You haven't posted any code, but I'm going to assume you are looping\sleeping in the Start event so it never finishes which is why you get this message. You've asked enough questions by now to know that unless you post the code there is little people can do to help.
 
Share this answer
 
Comments
Somesh Dhal 18-Aug-15 8:03am    
I just have a C++ RPC project...I dont have any start or stop methods there because I just have a rpc client and server and use sp create to create a service.(not writing code to create services)
F-ES Sitecore 18-Aug-15 8:07am    
So why did you tag your question c# then? If you don't tag your question correctly you're not going to get the correct solutions.
In C# you can do like this :

C#
private void KillService()
{
     Process serviceProcess = null;

     try
     {
         serviceProcess = Process.GetCurrentProcess();

          if(null != serviceProcess)
          {
             serviceProcess.Kill();
          }
      }
      catch
      {

      }
}


call this function in onStop with a delay timer
 
Share this answer
 
v2
Comments
Somesh Dhal 18-Aug-15 8:04am    
I just have a C++ RPC project...I dont have any start or stop methods there because I just have a rpc client and server and use sp create to create a service.(not writing code to create services)
sreeyush sudhakaran 19-Aug-15 1:13am    
How you created your service class in C++ using a Windows Implementation or just by start from main() entry point? , Is that you used sc create?. If there are any timers you used in the service in which you do a large dependency task , remove that code from timer , kill all threads on exit
"The service did not respond to the start or control request in a timely fashion"
This issue usually occurs while trying to Install Windows Service, On Install that Windows service starts execution (for what is has been created).

That execution time if is greater than 30 seconds, then the message "The service did not respond to the start or control request in a timely fashion"
flashes on the screen.

Now, to solve this issue, you can do one thing, Create one timer T1 & start that timer on Install of the Windows service & on the Tick event of timer T1 Start Timer T2 and stop Timer T1. On Tick event of Timer T2 start your Process/task for Which Window service is created.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900