该服务没有及时响应启动或控制请求? [英] The service did not respond to the start or control request in a timely fashion?

查看:121
本文介绍了该服务没有及时响应启动或控制请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个rpc服务器和客户端,它只打印一条简单的消息。我使用服务器exe文件(使用sc create)创建了一个服务,该文件在运行时打印消息服务没有及时响应启动或控制请求。我也尝试增加超时时间,因此它只显示相同的错误。那么如何解决这个问题呢?

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?

推荐答案

服务的开始事件需要完成其工作并在设定的时间内完成,通常是90秒。与你的Stop事件相同。



你还没有发布任何代码,但我会假设你在Start事件中循环播放,所以它永远不会完成这就是你收到这条消息的原因。你现在已经问了足够多的问题,除非你发布代码,否则很少有人能帮忙。
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.


在C#你可以这样做:



In C# you can do like this :

private void KillService()
{
     Process serviceProcess = null;

     try
     {
         serviceProcess = Process.GetCurrentProcess();

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

      }
}





在onStop中使用延迟计时器调用此函数



call this function in onStop with a delay timer


服务没有响应启动或及时控制请求

此问题通常发生在尝试安装Windows服务时,安装Windows服务开始执行(已创建)。



如果执行时间大于30秒,那么消息服务没有及时响应启动或控制请求

闪烁屏幕。



现在,为了解决这个问题,您可以做一件事,创建一个计时器T1并在安装Windows服务和Tick事件上启动该计时器定时器T1启动定时器T2并停止定时器T1。在Timer T2的Tick事件中,启动创建Window服务的Process / task。
"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.


这篇关于该服务没有及时响应启动或控制请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆