Topshelf service on server restart not started

709 views
Skip to first unread message

p....@iph.ch

unread,
Mar 9, 2015, 10:20:08 AM3/9/15
to topshelf...@googlegroups.com

Hello all

 

I have a self-hosted web service where I use TopShelf to install the application as a service. Generally this works very well however I have a problem, when the whole server hosting the service is restarted. Very often in this case the service is not started. In the Windows log I have the following entries:

 

1. A timeout was reached (30000 milliseconds) while waiting for the Name.Service service to connect.

2. The PoolAdmin.Backend.Service service failed to start due to the following error: The service did not respond to the start or control request in a timely Fashion.

 

In the application log I have the following entries in cases when the servcie does not start:

2015-03-06 00:17:56.4839 Info --> Configuration Result:

[Success] Name Bane.Service

[Success] ServiceName Name.Service

2015-03-06 00:17:56.9839 Info --> Topshelf v3.1.135.0, .NET Framework v4.0.30319.34209

2015-03-06 00:17:58.2183 Info --> Creating server at https://srv-test-285/ 

 

Normally I have some more entries when my service is started:

2015-03-06 09:30:57.2568 Info --> Starting as a Windows service

2015-03-06 09:30:57.2881 Info --> [Topshelf] Starting

2015-03-06 09:30:57.4443 Info --> Starting backend 'backend' with connection string 'xy'

… and then some more application log

 

It seems that in this special cases the internal call to tc.Start() is not executed (this would directly write the red log entry). So instanciating the servcie seems to be the problem (the blue log Comes from the service constructor).

 

x.Service<Service>(s =>

       {

              s.ConstructUsing(tc => new Service(baseAddress));

              s.WhenStarted(tc => tc.Start());

              s.WhenStopped(tc => tc.Stop());

       });

 

I do not have any additional messages in the log or exceptions. So what exactly is happening? Why does the service not start? Is there a way to get some more logging information out of TopShelf?

 

Philipp

 

Dru Sellers

unread,
Mar 9, 2015, 2:21:00 PM3/9/15
to topshelf...@googlegroups.com
Most likely its that your start is timing out. Take a look at the WhenStarted((svc, hostControl) => 
{
hostControl.RequestAdditionalTime(timeSpan);
return true;
}) method.

If your service is not starting fast enough this is away you can tell the SCM that you just need a bit more time.

-d

--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

p....@iph.ch

unread,
Mar 12, 2015, 9:46:16 AM3/12/15
to topshelf...@googlegroups.com
Thanks, I will try this out ...

Philipp
Reply all
Reply to author
Forward
0 new messages