Windows 服务未在 Windows 10 升级时启动 [英] Windows Service not starting on Windows 10 upgrade

查看:52
本文介绍了Windows 服务未在 Windows 10 升级时启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 Windows 服务,它在大多数操作系统中都可以正常工作并且可以正常启动.我已经缩小了从 Windows 8 升级的 Windows 10 导致的问题,即当服务设置为自动时,服务在重新启动时无法启动.我发现延迟启动确实可以.想知道是否有人知道完全从头开始安装和升级之间的细微差别,这可能表明这个难以捉摸的问题正在缩小.

I wrote a windows service it it works and STARTS fine in most operating systems. I have narrowed down the fact that Windows 10 upgraded from windows 8 causes a problem where the service does not start on reboot when the service is set to automatic. I find that start delayed does work ok. Wondered if anyone knew of nuances between a full from scratch install and an upgrade that might point to the narrowing in on this elusive issue.

当它不起作用时,不会生成任何日志或事件.它似乎没有尝试和失败 - 只是没有运行(启动).

When it does not work there are no logs or events generated. It does not seem to try and fail - just not run (start).

我刚刚遇到了一个运行良好的安装,并且操作系统是从 Win 8 升级的.似乎有一些不同的依赖项.该服务是针对 .Net Framework 4.0 x86 编写的.该服务手动启动就好了.自动(启动时)启动不起作用.我正要说它失败了 - 但事实并非如此,因为它似乎甚至没有尝试.

I just came across an installation where it works fine and the OS was upgraded from Win 8. There seems to be some dependency that is different. The service was written against .Net Framework 4.0 x86. The service starts manually just fine. automatic (at boot) startup does not work. I was about to say it fails - but that is not the case as it does not seem to even be trying.

推荐答案

我们在 Windows 10 中遇到了类似的问题,大多数基于 .Net 的服务在启动时会失败,但可以稍后手动启动就好了.出于某种原因,使用 .NET 编写的服务在 Windows 10 中需要更长的时间才能启动.默认情况下,如果服务启动时间超过 30 秒而没有响应,则该服务将被 Windows 终止.

We had a similar issue with windows 10 where most .Net based services would fail on startup, but could be started later manually just fine. For some reason, services that are written in .NET take longer to start in Windows 10. By default, if a service takes longer than 30 seconds to start without responding, the service is terminated by Windows.

我能够在注册表中将该行为更改为 60 秒.前往:

I was able to change that behavior to 60 seconds in the registry. Go to:

HKLM\SYSTEM\CurrentControlSet\Control\

HKLM\SYSTEM\CurrentControlSet\Control\

如果它不存在,请创建一个名为ServicesPipeTimeout"(减去引号)的 DWORD(32 位)键.将其值设置为 60000(十进制).这与以毫秒为单位的 60 秒相关.

If it doesn't already exist, create a DWORD (32-bit) key called "ServicesPipeTimeout"(minus quotes). Set its value to 60000(in decimal). This correlates to 60 seconds in milliseconds.

我什至创建了一个 regfile 来自动执行此操作:

I even created a regfile to automate this:

Windows 注册表编辑器 5.00 版

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]"ServicesPipeTimeout"=dword:0000ea60

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control] "ServicesPipeTimeout"=dword:0000ea60

只需粘贴到记事本中并另存为 .reg 文件即可.

Just paste into notepad and save as a .reg file.

不是延迟启动,而是增加了服务在启动后响应的时间.这为我们在多台机器上解决了这个问题.不幸的是,我仍然不知道为什么 .NET 服务需要这么长时间才能启动,以至于它们会被终止.但是,我觉得这是一个微软的错误,不一定是我们用户做错了什么......

This is not a delayed start, but an increase in the time given to services to respond after startup. This fixed the issue for us on multiple machines. Unfortunately, I still do not know why .NET services take so long to start that they get terminated. However, I feel this is a Microsoft bug, and not necessarily anything us users are doing wrong...

这篇关于Windows 服务未在 Windows 10 升级时启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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