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).


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.

Jeff
  • 1,764
  • 4
  • 22
  • 38
  • It seems like your premise is _"If you upgrade Windows 8 to Windows 10 your self-installed services that are set to 'Automatic' do not start when rebooting the machine"_, which is of course not true. If it were, that would be a massive problem that others would have encountered before you. I can hardly believe no single event log message is generated. Are you sure about that? – CodeCaster Oct 20 '15 at 13:57
  • 1
    There are NO events generated. – Jeff Oct 20 '15 at 14:38
  • I have exactly the same problem, not yet managed to work out under which circumstances it reproduces. The windows log shows a timeout error, but none of my log4net logs are produced. – msshapira Nov 25 '15 at 21:42
  • Some other links: https://superuser.com/questions/1026496/automatic-services-doesnt-start-automatically-after-windows-restart and https://social.technet.microsoft.com/Forums/windows/en-US/a6e5d2b4-f591-40b0-825a-0818ea5bb254/windows-10-services-not-starting-up?forum=win10itprogeneral – RenniePet Nov 25 '17 at 03:10
  • I am also experiencing this - a custom Windows Service (which works fine on Win7) developed with VS 2015 (C# .NET 4) does not start when my customer with a Win10 machine restarts. No Windows Application Event log entries, and specifically not a single line of log4net logging output - Windows just skipped us altogether. – rich p Nov 10 '19 at 22:25

4 Answers4

5

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.

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

HKLM\SYSTEM\CurrentControlSet\Control\

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.

I even created a regfile to automate this:

Windows Registry Editor Version 5.00

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

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

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...

  • 1
    instead of changing the registry yourself, if using a delayed start doesn't work for you, you could go to the service's properties and try the service recovery. under the recovery tab you have options of what to do when the service fails to start. you could in fact try to restart it with a delay ("restart service after X minutes"). – Itay Bianco Jun 28 '16 at 16:31
2

We have a similar issue where one of our services (.net) does not start automatically in some cases after upgrading to Windows 10. Also, in a number of situations the problem was solved after updating to Windows build 10.0.10240; not in every case though. No errors in the event log either.

Update: a delayed start also seems to work in some cases.

2

We also have the same problem with a C++ windows service that we created. Automatic startup works fine for most people. However we have 5 instances now where the customer's service was working fine and now it will not automatically start up.

The only thing that seems to work is setting to delayed start, but this is not a good option as we would like the service to be started right away. We've also tried adding service dependency of NetLogon - which did not work.

Also note that this was working fine for customers and at some point (windows update maybe?) it just stopped automatically starting.

The customers are also able to go into services and start the service manually, and it works. I'll be following this thread and hoping for a better solution than delayed start.

Megan
  • 669
  • 1
  • 6
  • 18
1

What fixed it for us is, if you can change the service executable yourself:

In the project file change the Prefer 32-bit flag to false, then reinstall the service.

Check your service with CorFlags.exe. The 32BITREQ and 32BITPREF should be 0.

Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 0x1
ILONLY    : 1
32BITREQ  : 0
32BITPREF : 0
Signed    : 0