2

Should we under any circumstances try to manually invoke the lifecycle methods of ASP .net Core IHostedService? The MSDN documentations I read so far do not seem to mention that anywhere, it's more likely to be coupled tightly with app lifespan.

The other doubt I have is even if we do invoke StartAsync/StopAsync, is there anyway to tell the application not to invoke StartAsync when application loads?

I know this is kind of duplicate to this,but the post didn't really answer my query.

Sanky
  • 193
  • 13
  • What does it mean to "manually invoe the lifecycle methods" on a hosted service and why do you want to do that: what is the problem you are trying to solve? – Steven Mar 14 '19 at 08:41
  • Ok..so my target is to start a background service on ad hoc basis as per requirement, let it continue to run until a cancellation signal comes. I don't want this to start with application. Does IHostedService fit here? – Sanky Mar 14 '19 at 08:58

0 Answers0