This question is in continuation with this SO question. I just wanted to understand the differences between a Windows Service that is written using ServiceBase class like in this post and a windows service using a WorkerTemplate, done here.
The reason for this question is that the former implementation is working on docker and the later is not.
If I understood correctly WorkerTemplate is an attempt to make, development of windows service easier by providing a package that would provide an abstraction ExecuteAsync() over StartAsync() and managing the lifetime of service by replacing IHostingLifetime with AddHostedService<>(). Then why is it that when I run the application with ServiceBase and IHostingLifetime it works fine in a container and when I use WorkerTemplate it throws me a service timeout error.
Note: Both the implementations are working fine locally as well as when deployed on servers. This behavior is observed in containers only.