jacob
jacob

Reputation: 1427

.net service start timeout on windows startup

I have a .net service that starts when windows starts, and sometimes ( totally random ) the service fails to start.

Event viewer shows: A timeout was reached (30000 milliseconds) while waiting for the MYSERVICE service to connect.

Even on the machines that the service fails to start if I start it manually (after windows logon ) it start fine.

My start method is very basic, it just starts a new thread with the actual start-up logic ( usually is very fast ).

My service requires .net 3.5 sp1 and the machines that are having these problems are win7 x64. I suspect that it has something to do with the .net framework, but I don't know how. This is happening on a clients machines and he has the .net 4 client profile installed.

Any ideas?

Upvotes: 2

Views: 4082

Answers (4)

user2547006
user2547006

Reputation: 63

For anyone struggling with this issue,we have had the same exact issue on some of the slower windows 10 machines. We were able to solve this issue by setting generatePublisherEvidence to false in the config file.

You may read more about this here-> https://blogs.msdn.microsoft.com/winsdk/2010/01/29/you-may-get-a-service-timeout-from-a-signed-net-managed-service-application-while-the-system-is-doing-a-revocation-check-of-the-certificate-over-the-internet/

Upvotes: 0

Cameron VanNatta
Cameron VanNatta

Reputation: 181

We had a similar issue on 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, but this fix works on any version of Windows, including Windows 7. 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...

Upvotes: 1

paparazzo
paparazzo

Reputation: 45096

If it is dependent on another service then make set the dependency.

Upvotes: 1

Ignacio Soler Garcia
Ignacio Soler Garcia

Reputation: 21855

I've had problems like this one. Normally is due to the machine load on startup. For example, I had this error on SQL Server due to many other services starting too.

One simple way of fixing this is setting the service to start in delayed mode because then your service will be started under less CPU and HD load.

Upvotes: 3

Related Questions