Windows服务器中服务的起始顺序是什么

前端之家收集整理的这篇文章主要介绍了Windows服务器中服务的起始顺序是什么前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个 Windows服务,在大多数服务器上工作正常.但是在一台服务器中,我看到它是在网络服务启动之前启动的.这导致服务挂起,因此操作系统无法启动.它也卡住了.什么是通常的服务启动顺序?我的Windows服务确实建立了TCP连接.我应该加一个延迟开始吗?如果是这种情况,那么在这些网络服务之后,是否所有服务都不应该延迟启动?任何帮助将非常感激.
使用延迟启动可能是一种可能的解决方案.

另一种可能性是添加依赖项,以便按照您想要的顺序启动服务.例如,您不希望您的服务在NSI服务之前启动,因为在NSI服务运行之前,网络连接不会发生.所以添加依赖项.

MSDN开始:

if an auto-start service depends on a demand-start service,the demand-start service is also started automatically.

(关于开始顺序的更多细节也在该MSDN文章中.)

但是,如果我是你,那么这两件事中的任何一件都可能有用,我更想知道这台服务器的不同之处.在修改系统设置并使这台服务器与其他服务器相比成为“特殊雪花”之前,始终要完全了解正在发生的事情和原因是个好主意.

编辑:

你让我更多地思考这个问题,“Windows中服务的起始顺序是什么,”我的意思是,确切的顺序,我认为问题没有得到彻底的回答,至少不是公开的.

我认为这部分是因为它非常复杂. Windows服务的确切启动顺序总是在变化.有“早期启动服务”,“第1阶段服务”,“第2阶段服务”,服务组,因为它们是依赖关系等而开始的服务等.每个版本和版本的Windows都会略有不同,并且在不同的配置和部署选项方面也会有所不同.因此,除了最通用的相对术语之外,不要指望它被正式记录在其他任何内容中,例如“在自动启动服务之后启动延迟启动服务”.

我认为这也部分是因为这是一种非确定性的情况.服务控制管理器(用户模式下的services.exe)将启动信号发送到服务,该部分的顺序非常确定,但发送启动信号的时间和服务实际启动的时间是两件不同的事.由于Windows的抢先性,我们不能总是保证服务A将在服务B之前启动,即使SCM首先向服务A发送启动控制. (除非我们使用某种同步机制.)

无论如何,我想我至少可以在启动期间启用一些SCM日志记录,并按时间顺序查看SCM启动所有服务.

这是Windows 10,RS1 / 1607.正如我之前提到的,基本上任何其他构建的结果都会略有不同.结果已根据篇幅和内容进行了编辑.首先,我认为显示服务进入Running状态的时间顺序是最有趣的,不一定是SCM尝试启动它们的顺序.

07/06/17-13:05:39.7425860 [SCM] service PlugPlay,state 0x00000004(SERVICE_RUNNING),exit 0,sexit 0,controls 0x00000005
07/06/17-13:05:39.8150411 [SCM] service Power,controls 0x00000000
07/06/17-13:05:39.8629388 [SCM] service DcomLaunch,controls 0x00000080
07/06/17-13:05:39.8699565 [SCM] service RpcEptMapper,controls 0x00000000
07/06/17-13:05:39.8745944 [SCM] service RpcSs,controls 0x000000c0
07/06/17-13:05:39.9107503 [SCM] service BrokerInfrastructure,controls 0x00001080
07/06/17-13:05:39.9276072 [SCM] service LSM,controls 0x00000000
07/06/17-13:05:40.0868049 [SCM] service SystemEventsBroker,controls 0x000012c1
07/06/17-13:05:40.4599977 [SCM] service nsi,controls 0x00000001
07/06/17-13:05:40.4641823 [SCM] service lmhosts,controls 0x00000001
07/06/17-13:05:40.4705790 [SCM] service TermService,controls 0x00000005
07/06/17-13:05:40.4708935 [SCM] service CoreMessagingRegistrar,controls 0x00000000
07/06/17-13:05:40.4943177 [SCM] service gpsvc,controls 0x00000141
07/06/17-13:05:40.4975091 [SCM] service gpsvc,controls 0x00000541
07/06/17-13:05:40.5067210 [SCM] service TimeBrokerSvc,controls 0x00000241
07/06/17-13:05:40.5877317 [SCM] service UmRdpService,controls 0x00000085
07/06/17-13:05:40.6327091 [SCM] service Dnscache,controls 0x00000059
07/06/17-13:05:40.6501216 [SCM] service CertPropSvc,controls 0x00000085
07/06/17-13:05:40.6716164 [SCM] service Dhcp,controls 0x00000005
07/06/17-13:05:40.6785583 [SCM] service Schedule,controls 0x000012c5
07/06/17-13:05:40.7442193 [SCM] service LanmanWorkstation,controls 0x00000043
07/06/17-13:05:40.7560620 [SCM] service EventLog,controls 0x00000205
07/06/17-13:05:40.8915301 [SCM] service SessionEnv,controls 0x00000281
07/06/17-13:05:40.9149615 [SCM] service ProfSvc,controls 0x00000005
07/06/17-13:05:40.9173657 [SCM] service NlaSvc,controls 0x000000c1
07/06/17-13:05:40.9429894 [SCM] service netprofm,controls 0x000000c1
07/06/17-13:05:40.9494092 [SCM] service UserManager,controls 0x00000001
07/06/17-13:05:41.0502482 [SCM] service NcbService,controls 0x00000081
07/06/17-13:05:41.2351873 [SCM] service vmickvpexchange,controls 0x00000003
07/06/17-13:05:41.2897569 [SCM] service vmictimesync,controls 0x00000003
07/06/17-13:05:41.3259511 [SCM] service vmicshutdown,controls 0x00000003
07/06/17-13:05:41.3284648 [SCM] service vmicvss,controls 0x00000103
07/06/17-13:05:41.3444338 [SCM] service Themes,controls 0x00000001
07/06/17-13:05:41.3548424 [SCM] service vmicrdv,controls 0x00000003
07/06/17-13:05:41.3823139 [SCM] service WPDBusEnum,controls 0x000004c1
07/06/17-13:05:41.3843401 [SCM] service WinHttpAutoProxySvc,controls 0x00000041
07/06/17-13:05:41.3856439 [SCM] service vmicheartbeat,controls 0x00000003
07/06/17-13:05:41.3874138 [SCM] service EventSystem,controls 0x00000001
07/06/17-13:05:41.5580789 [SCM] service SENS,controls 0x00000041
07/06/17-13:05:41.6772846 [SCM] service FontCache,controls 0x00000005
07/06/17-13:05:41.9209576 [SCM] service AudioEndpointBuilder,controls 0x000000c1
07/06/17-13:05:42.0189267 [SCM] service VSS,controls 0x00000005
07/06/17-13:05:42.0210403 [SCM] service Audiosrv,controls 0x000000c1
07/06/17-13:05:42.0484759 [SCM] service SamSs,controls 0x00000000
07/06/17-13:05:42.2429764 [SCM] service Wcmsvc,controls 0x000012c5
07/06/17-13:05:42.2906325 [SCM] service ShellHWDetection,controls 0x000000c1
07/06/17-13:05:42.5323497 [SCM] service Spooler,controls 0x000004c1
07/06/17-13:05:42.5431893 [SCM] service ScDeviceEnum,controls 0x00000481
07/06/17-13:05:42.5485449 [SCM] service wudfsvc,controls 0x00000000
07/06/17-13:05:42.5989161 [SCM] service NetSetupSvc,controls 0x00000001
07/06/17-13:05:42.6021970 [SCM] service WbioSrvc,controls 0x00000441
07/06/17-13:05:42.6391087 [SCM] service SCardSvr,controls 0x00000481
07/06/17-13:05:42.7007534 [SCM] service NgcCtnrSvc,controls 0x00000001
07/06/17-13:05:42.7017472 [SCM] service BFE,controls 0x00000041
07/06/17-13:05:42.7098576 [SCM] service Winmgmt,controls 0x00000007
07/06/17-13:05:42.7222523 [SCM] service Netlogon,controls 0x00000003
07/06/17-13:05:42.8153049 [SCM] service iphlpsvc,controls 0x000000c9
07/06/17-13:05:42.8854162 [SCM] service CryptSvc,controls 0x00000085
07/06/17-13:05:42.8857247 [SCM] service DPS,controls 0x00000005
07/06/17-13:05:43.0717978 [SCM] service LanmanServer,controls 0x00000001
07/06/17-13:05:44.1651270 [SCM] service PcaSvc,controls 0x00000085
07/06/17-13:05:44.3247890 [SCM] service TrkWks,controls 0x00000005
07/06/17-13:05:44.3303880 [SCM] service DiagTrack,controls 0x000013c5
07/06/17-13:05:44.3364873 [SCM] service MpsSvc,controls 0x00000001
07/06/17-13:05:44.3497466 [SCM] service SysMain,controls 0x000000c5
07/06/17-13:05:44.3573408 [SCM] service WpnService,controls 0x00000401
07/06/17-13:05:44.3581205 [SCM] service WdiServiceHost,controls 0x00000005
07/06/17-13:05:44.7769374 [SCM] service sppsvc,controls 0x00000005
07/06/17-13:05:45.1100224 [SCM] service wisvc,controls 0x00000005
07/06/17-13:05:45.2168257 [SCM] service fhsvc,controls 0x000004c5
07/06/17-13:05:45.2489211 [SCM] service WinDefend,controls 0x000000c5
07/06/17-13:05:45.3731715 [SCM] service wuauserv,controls 0x000000c5
07/06/17-13:05:45.3899756 [SCM] service WinHttpAutoProxySvc,controls 0x00000041
07/06/17-13:05:45.3958062 [SCM] service StateRepository,controls 0x0000000d
07/06/17-13:05:45.6152215 [SCM] service tiledatamodelsvc,controls 0x00000181
07/06/17-13:05:47.3504859 [SCM] service SCardSvr,controls 0x00000481
07/06/17-13:05:47.5248612 [SCM] service WdNisSvc,controls 0x00000001
07/06/17-13:05:47.9543134 [SCM] service SCardSvr,controls 0x00000481
07/06/17-13:05:47.9543975 [SCM] service SCardSvr,controls 0x00000481
07/06/17-13:05:48.5741736 [SCM] service CDPUserSvc_33f2e,controls 0x000000c1
07/06/17-13:05:50.7171925 [SCM] service W32Time,controls 0x0000007d
07/06/17-13:05:51.0991216 [SCM] service wlidsvc,controls 0x00000081
07/06/17-13:05:51.2245142 [SCM] service KeyIso,controls 0x00000001
07/06/17-13:05:51.4173887 [SCM] service WSearch,controls 0x000010c5
07/06/17-13:05:52.7271615 [SCM] service Appinfo,controls 0x00000081

接下来,我们按时间顺序列出了SCM发送启动控件的Windows服务.请注意,此列表更短.并且它可能并不总是以相同的顺序.

07/06/17-13:05:40.4600357 [SCM] Successfully sent start control to service gpsvc,user S-1-5-18
07/06/17-13:05:40.4601289 [SCM] Successfully sent start control to service lmhosts,user S-1-5-18
07/06/17-13:05:40.4601542 [SCM] Successfully sent start control to service CoreMessagingRegistrar,user S-1-5-90-0-1
07/06/17-13:05:40.4602090 [SCM] Successfully sent start control to service TermService,user S-1-5-18
07/06/17-13:05:40.4602341 [SCM] Successfully sent start control to service NcbService,user S-1-5-18
07/06/17-13:05:40.4602536 [SCM] Successfully sent start control to service W32Time,user S-1-5-18
07/06/17-13:05:40.4660675 [SCM] Successfully sent start control to service TimeBrokerSvc,user S-1-5-18
07/06/17-13:05:40.5068238 [SCM] Successfully sent start control to service Schedule,user S-1-5-18
07/06/17-13:05:40.5435413 [SCM] Successfully sent start control to service RdpVideoMiniport,user S-1-5-20
07/06/17-13:05:40.5877716 [SCM] Successfully sent start control to service UmRdpService,user S-1-5-20
07/06/17-13:05:40.6336400 [SCM] Successfully sent start control to service CertPropSvc,user S-1-5-20
07/06/17-13:05:40.8919486 [SCM] Successfully sent start control to service SessionEnv,user S-1-5-20
07/06/17-13:05:40.9437595 [SCM] Successfully sent start control to service netprofm,user S-1-5-18
07/06/17-13:05:40.9437849 [SCM] Successfully sent start control to service UserManager,user S-1-5-18
07/06/17-13:05:41.2444548 [SCM] Successfully sent start control to service vmickvpexchange,user S-1-5-18
07/06/17-13:05:41.2898074 [SCM] Successfully sent start control to service vmicvss,user S-1-5-18
07/06/17-13:05:41.2898367 [SCM] Successfully sent start control to service vmicshutdown,user S-1-5-18
07/06/17-13:05:41.2902957 [SCM] Successfully sent start control to service vmictimesync,user S-1-5-18
07/06/17-13:05:41.3260049 [SCM] Successfully sent start control to service WPDBusEnum,user S-1-5-18
07/06/17-13:05:41.3444823 [SCM] Successfully sent start control to service vmicheartbeat,user S-1-5-18
07/06/17-13:05:41.3548887 [SCM] Successfully sent start control to service WinHttpAutoProxySvc,user S-1-5-20
07/06/17-13:05:41.3549103 [SCM] Successfully sent start control to service vmicrdv,user S-1-5-18
07/06/17-13:05:41.9211318 [SCM] Successfully sent start control to service VSS,user S-1-5-18
07/06/17-13:05:42.5324545 [SCM] Successfully sent start control to service ScDeviceEnum,user S-1-5-18
07/06/17-13:05:42.5989696 [SCM] Successfully sent start control to service NetSetupSvc,user S-1-5-18
07/06/17-13:05:42.7008186 [SCM] Successfully sent start control to service NgcCtnrSvc,user S-1-5-18
07/06/17-13:05:44.1651981 [SCM] Successfully sent start control to service WdiServiceHost,user S-1-5-19
07/06/17-13:05:44.3231928 [SCM] Successfully sent start control to service NcaSvc,user S-1-5-18
07/06/17-13:05:44.7769902 [SCM] Successfully sent start control to service sppsvc,user S-1-5-20
07/06/17-13:05:45.1100675 [SCM] Successfully sent start control to service wisvc,user S-1-5-18
07/06/17-13:05:45.2169191 [SCM] Successfully sent start control to service wuauserv,user S-1-5-18
07/06/17-13:05:45.2169410 [SCM] Successfully sent start control to service fhsvc,user S-1-5-18
07/06/17-13:05:45.6471780 [SCM] Successfully sent start control to service NcaSvc,user S-1-5-18
07/06/17-13:05:47.3489415 [SCM] Successfully sent start control to service WdNisSvc,user S-1-5-18
07/06/17-13:05:49.4258072 [SCM] Successfully sent start control to service CDPSvc,user S-1-5-18
07/06/17-13:05:50.9283667 [SCM] Successfully sent start control to service WSearch,user S-1-5-18
07/06/17-13:05:51.0034313 [SCM] Successfully sent start control to service wlidsvc,user S-1-5-18
07/06/17-13:05:51.1906412 [SCM] Successfully sent start control to service KeyIso,user S-1-5-18
07/06/17-13:05:52.5810658 [SCM] Successfully sent start control to service Appinfo,user S-1-5-18
原文链接:https://www.f2er.com/windows/367733.html

猜你在找的Windows相关文章