File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11theme : " jekyll-theme-cayman"
2- description : " CodeCaster.WindowsServices documentation"
2+ description : " CodeCaster.WindowsServiceExtensions documentation"
33url : " https://codecasternl.github.io/WindowsServiceExtensions/"
44defaults :
55 -
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ If you let your service inherit `CodeCaster.WindowsServiceExtensions.Service.Win
9090public class MyCoolBackgroundService : WindowsServiceBackgroundService
9191{
9292 public MyCoolBackgroundService (
93- ILogger <MyFaultyWindowsServiceBackgroundService > logger ,
93+ ILogger <MyCoolBackgroundService > logger ,
9494 IHostLifetime hostLifetime
9595 )
9696 : base (logger , hostLifetime )
@@ -103,12 +103,8 @@ public class MyCoolBackgroundService : WindowsServiceBackgroundService
103103 // Do your continuous or periodic background work.
104104 await SomeLongRunningTaskAsync ();
105105
106- // We're done, let the service stop.
107- ServiceLifetime .ExitCode = 0 ;
108-
109- // This kills the process about immediately, you can also inject `IHostApplication`
110- // and call StopAsync() on that.
111- await ServiceLifetime .StopAsync ();
106+ // This will report to the SCM that your service failed.
107+ throw new Exception (" Foo" );
112108 }
113109
114110 // This one tells you when we're shutting down or resuming from semi-hibernation
You can’t perform that action at this time.
0 commit comments