Skip to content

Commit 941ca70

Browse files
Update Windows Service documentation with new review date and improved clarity
1 parent a95c410 commit 941ca70

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

nservicebus/hosting/windows-service.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Windows Service Installation
33
summary: How to install an NServiceBus endpoint as a Windows service
4-
reviewed: 2023-09-15
4+
reviewed: 2025-07-31
55
component: Core
66
isLearningPath: true
77
related:
@@ -20,8 +20,10 @@ sc.exe create SalesEndpoint binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-a
2020
sc.exe delete SalesEndpoint
2121
```
2222

23-
For completeness, here are some other common usages of the Service Control tool:
23+
> [!NOTE]
24+
> A space is required between an option and its value (for example, `binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-as-service"`). If the space is omitted, the operation will fail.
2425
26+
For completeness, here are some other common usages of the Service Control tool:
2527

2628
### Setting the Windows Service name
2729

@@ -32,7 +34,6 @@ sc.exe create [ServiceName] binpath= [BinaryPathName]
3234
sc.exe create SalesEndpoint binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-as-service"
3335
```
3436

35-
3637
### Setting the Display name
3738

3839
The display name can be configured, at creation time, using the `displayname` argument:
@@ -42,7 +43,6 @@ sc.exe create [ServiceName] displayname= [Description] binpath= [BinaryPathName]
4243
sc.exe create SalesEndpoint displayname= "Sales Endpoint" binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-as-service"
4344
```
4445

45-
4646
### Setting the Description
4747

4848
The description can be changed, after the Windows Service has been created, using the [sc description](https://technet.microsoft.com/en-us/library/cc742069.aspx) command.
@@ -52,17 +52,15 @@ sc.exe description [ServiceName] [Description]
5252
sc.exe description SalesEndpoint "Service for hosting the Sales Endpoint"
5353
```
5454

55-
5655
### Specifying Service dependencies
5756

58-
The dependencies of a Windows Service can be configured after it has been created using the [sc config](https://technet.microsoft.com/en-us/library/cc990290.aspx) command.
57+
The dependencies of a Windows Service can be configured after it has been created using the [sc config](https://technet.microsoft.com/en-us/library/cc990290.aspx) command. Dependencies are listed one after the other, separated by a `/` (forward slash).
5958

6059
```shell
61-
sc.exe config [ServiceName] depend= <Dependencies(separated by / (forward slash))>
60+
sc.exe config [ServiceName] depend= [Dependency1]/[Dependency2]
6261
sc.exe config SalesEndpoint depend= MSMQ/MSDTC/RavenDB
6362
```
6463

65-
6664
### Setting the Restart Recovery Options
6765

6866
Windows has a Windows Service recovery mechanism that makes sure a crashed process will be restarted.
@@ -73,7 +71,6 @@ If Windows Service Recovery is not configured, message processing will halt. The
7371

7472
The recovery options can be adjusted via the Services dialog or via `sc.exe`. Note that the command line tool has advanced configuration options.
7573

76-
7774
#### Configuring Windows Service Recovery via sc.exe
7875

7976
The default restart duration is 1 minute when enabling recovery via the Windows Service Management Console, but a different restart duration may be defined for the subsequent restarts using `sc.exe`.
@@ -85,7 +82,6 @@ sc.exe failure [ServiceName] reset= [seconds] actions= restart/[milliseconds]/re
8582
sc.exe failure SalesEndpoint reset= 3600 actions= restart/5000/restart/10000/restart/60000
8683
```
8784

88-
8985
#### Configuring Service Recovery via Windows Service properties
9086

9187
Open the services window, select the endpoint Windows Service and open its properties. Then open the Recovery tab to adjust the settings:
@@ -95,7 +91,6 @@ Open the services window, select the endpoint Windows Service and open its prope
9591
> [!NOTE]
9692
> Restart durations are only configurable using `sc.exe`.
9793
98-
9994
### Username and password
10095

10196
Username and password can be configured at creation time using the `obj` and `password` parameters.
@@ -105,7 +100,6 @@ sc.exe create [ServiceName] obj= [AccountName] password= [Password] binpath= [Bi
105100
sc.exe create SalesEndpoint obj= MyDomain\SalesUser password= 9t6X7gkz binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-as-service"
106101
```
107102

108-
109103
### Start mode
110104

111105
The Windows Service start mode can be configured at creation time using the `start` parameter.
@@ -115,12 +109,11 @@ sc.exe create [ServiceName] start= {auto | demand | disabled} binpath= [BinaryPa
115109
sc.exe create SalesEndpoint start= demand binpath= "c:\SalesEndpoint\SalesEndpoint.exe --run-as-service"
116110
```
117111

118-
119112
### Uninstall
120113

121114
A Windows Service can be uninstalled using the [sc delete](https://technet.microsoft.com/en-us/library/cc742045.aspx) command.
122115

123116
```shell
124117
sc.exe delete [ServiceName]
125118
sc.exe delete SalesEndpoint
126-
```
119+
```

0 commit comments

Comments
 (0)