即使启动类型设置为自动(延迟启动),自定义创建的服务似乎也不会在启动时执行 [英] Custom-created service seemingly not executing on boot even when Startup Type set to Automatic (Delayed Start)
问题描述
我已经注册了一个名为 customService
自动
(延迟启动) 作为其启动类型选项。它是使用 NSSM 使用以下命令
I have registered a custom service called customService
with Automatic
(Delayed Start) as its Startup Type option. It was created using NSSM with the following command
nssm install customService
它运行一个简单的批处理文件, customService.bat
包含
两个简单的windows命令
It runs a simple batch file, customService.bat
containing
two simple windows command
cd C:\To\Custom\Path
type NUL > 1.txt
服务的作用是运行这个批处理文件,它会在\To \Custom中创建一个空文本文件,1.txt \\ path文件夹。
What the service does is run this batch file which would create an empty text file, 1.txt in \To\Custom\Path folder.
问题
当我 shutdown and boot up 我的机器,没有创建1.txt。但是,在services.msc中,它显示 customService
status
as Running。为什么会这样?
When I shutdown and boot up my machine, no 1.txt is created. However, in services.msc, it shows customService
status
as Running. Why is this happening?
我发现了什么
- 当问题发生时,在事件日志> Windows日志>应用程序中,没有产生错误。最后记录的日志来自
MSSQLSERVER
service
,信息等级和事件ID为8128.已经过了15分钟。 - In
services.msc
>customService
Status
显示Running。当我右键单击它时,我被允许至少3个选项:Stop,Pause和Restart。当我点击重新启动
。 - In
services.msc
>customService
属性
>依赖关系选项卡,它显示 no Dependencies - 当我 restart 我的电脑(即1.txt已创建。)
- When the problem occurs, in Event Logs > Windows logs > Application, there is no error produced. The last recorded log is from
MSSQLSERVER
service with the Level of Information and Event ID of 8128. It has been exactly 15 minutes passed. - In
services.msc
>customService
Status shows Running. When I right-click it, I'm allowed at least 3 options: Stop, Pause, and Restart. The service runs successfully (i.e., 1.txt created) when I clickedRestart
. - In
services.msc
>customService
properties > Dependencies tab, it shows no Dependencies - I have absolutely no problems when I restart my computer ( i.e., 1.txt is created.)
Specs
我有 Windows
运行时显示
10版本1607(OS Build 14393.576) winver
命令。
此外,我已安装所有更新。
I have Windows
10 Version 1607 (OS Build 14393.576)
as shown when running winver
command.
Also, I have all updates installed.
推荐答案
你好equals2nine,
Hi equals2nine,
感谢您在此发帖。
> ;>" 当我关机并启动我的机器时,没有创建1.txt。它显示自定义服务状态为正在运行"
我认为服务应用程序无法正常运行,但您的服务状态正在运行。
I think the service application does not work successfully , though your service status is running.
当机器再次重启时,您是否将启动类型设置为自动?我认为该服务确实成功运行。
Did you set the startup type as automatic? when the machine reboots again. I think the service really runs successfully.
最好的问候,
Hart
这篇关于即使启动类型设置为自动(延迟启动),自定义创建的服务似乎也不会在启动时执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!