Skip to content

Commit 40fd40d

Browse files
committed
Docs: show exception example, fix library and service class name
1 parent 59bb8ac commit 40fd40d

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

docs/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
theme: "jekyll-theme-cayman"
2-
description: "CodeCaster.WindowsServices documentation"
2+
description: "CodeCaster.WindowsServiceExtensions documentation"
33
url: "https://codecasternl.github.io/WindowsServiceExtensions/"
44
defaults:
55
-

docs/index.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ If you let your service inherit `CodeCaster.WindowsServiceExtensions.Service.Win
9090
public 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

0 commit comments

Comments
 (0)