本文翻译自:“Automatic” vs “Automatic (Delayed start)”
When installing Windows services there are two options for automatically starting a Windows service on Windows startup. 安装Windows服务时,有两个选项可以在Windows启动时自动启动Windows服务。 One is Automatic , and the other is Automatic (Delayed start) . 一个是自动 ,另一个是自动(延迟启动) 。 What is the difference between these two in detail? 这两者之间有什么区别?
For example, if you're creating the installer with wixtoolset, the ServiceConfig
element has the DelayedAutoStart
attribute. 例如,如果您使用wixtoolset创建安装程序,则ServiceConfig
元素具有DelayedAutoStart
属性。 How will that effect what happens when services are started at boot time? 如何在启动时启动服务时会发生什么?
WiX documentation: ServiceConfig Element WiX文档: ServiceConfig元素
#1楼
参考:https://stackoom.com/question/kDYL/自动-与-自动-延迟启动
#2楼
In short, services set to Automatic will start during the boot process, while services set to start as Delayed will start shortly after boot. 简而言之,设置为Automatic的服务将在引导过程中启动,而设置为Delayed的服务将在引导后立即启动。
Starting your service Delayed improves the boot performance of your server and has security benefits which are outlined in the article Adriano linked to in the comments. 启动服务延迟可以提高服务器的启动性能,并且具有安全性优势,这些优势在评论中链接到Adriano 的文章中列出。
Update: "shortly after boot" is actually 2 minutes after the last "automatic" service has started, by default. 更新: “启动后不久”实际上是在最后一次“自动”服务启动后2分钟,默认情况下。 This can be configured by a registry key, according to Windows Internals and other sources ( 3 , 4 ). 这可以通过一个注册表项根据被配置, Windows内部和其他来源( 3 , 4 )。
The registry keys of interest (At least in some versions of windows) are: 感兴趣的注册表项(至少在某些版本的Windows中)是:
-
HKLM\\SYSTEM\\CurrentControlSet\\services\\<service name>\\DelayedAutostart
will have the value1
if delayed,0
if not. 如果没有延迟,HKLM\\SYSTEM\\CurrentControlSet\\services\\<service name>\\DelayedAutostart
的值为1
否则为0
。 -
HKLM\\SYSTEM\\CurrentControlSet\\services\\AutoStartDelay
orHKLM\\SYSTEM\\CurrentControlSet\\Control\\AutoStartDelay
(on Windows 10): decimal number of seconds to wait, may need to create this one.HKLM\\SYSTEM\\CurrentControlSet\\services\\AutoStartDelay
或HKLM\\SYSTEM\\CurrentControlSet\\Control\\AutoStartDelay
(在Windows 10上):等待的十进制秒数,可能需要创建此一个。 Applies globally to all Delayed services. 全局适用于所有延迟服务。