windows 如何启动windows服务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7370522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to start windows service
提问by M_Mogharrabi
I have created a windows service with Automatic Start Type and install it in my system successfully but it does not start until i restart my system. Details: yesterday i have create and install my service and then restart my windows so the service started successfully. but the problem occurred today when i boot my windows and opened the services list of windows from Control Panel\Administrative Tools\Services and selected my service i saw that it did not start automatically. what is my mistake?
我已经创建了一个具有自动启动类型的 Windows 服务,并成功地将它安装在我的系统中,但它在我重新启动系统之前不会启动。详细信息:昨天我已经创建并安装了我的服务,然后重新启动了我的 Windows,以便该服务成功启动。但是今天当我启动 Windows 并从控制面板\管理工具\服务打开窗口的服务列表并选择我的服务时出现问题,我看到它没有自动启动。我的错误是什么?
采纳答案by Eight-Bit Guru
Assuming the service is set to 'Automatic' as the startup mode, and that it's state is not 'Started', then there will be at least one message about why the service did not start in the System Event Log.
假设服务设置为“自动”作为启动模式,并且它的状态不是“已启动”,那么系统事件日志中将至少有一条关于服务未启动的消息。
Typical reasons are that the service didn't start quickly enough (Service Controller imposes a time limit on how quickly services must respond to the 'Start' message) or that the service depended on another service which wasn't yet available (check your service dependencies) or that your service simply failed due to a software error (e.g. some resource it needs could not be found).
典型的原因是服务启动得不够快(服务控制器对服务响应“启动”消息的速度施加了时间限制)或者服务依赖于另一个尚不可用的服务(检查您的服务依赖项)或者您的服务只是由于软件错误而失败(例如,找不到它需要的某些资源)。
Find the error in the event log, and you'll have a much better idea of why your service hasn't started.
在事件日志中查找错误,您将更好地了解服务未启动的原因。
回答by Bhupendra d
As your service was running fine yesterday but not today. Checking all its dependencies would be my first suggestion.
因为您的服务昨天运行良好,但今天不行。检查其所有依赖项将是我的第一个建议。
In your Start-> Run, type services.msc . It's a shortcut to open the services console.
在开始-> 运行中,输入 services.msc 。这是打开服务控制台的快捷方式。
Then Right click on your service , if it is listed there, click on Properties on this popup menu.
然后右键单击您的服务,如果它在那里列出,请单击此弹出菜单上的属性。
Open the Dependency tab (4th tab) , check if your service depends on some other service and that dependency is running.
打开 Dependency 选项卡(第 4 个选项卡),检查您的服务是否依赖于其他一些服务并且该依赖项正在运行。
Regards,
问候,
回答by Abdeloihab Bourassi
Example:
例子:
SC.exe config "ServiceName" start= auto