You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
summary: Uses NServiceBus the self-hosting capability to host an endpoint in an Azure WebJob.
3
+
summary: Host an NServiceBus endpoint in Azure WebJobs.
4
4
component: Core
5
-
reviewed: 2022-11-08
5
+
reviewed: 2025-03-06
6
6
isLearningPath: true
7
-
related:
8
-
- samples/dependency-injection/aspnetcore
9
7
redirects:
10
8
- samples/azure/self-host
11
9
- samples/azure/shared-host
12
10
---
13
11
14
-
This sample is compatible with Azure WebJobs SDK 3.0.
12
+
This is an example of how an NServiceBus endpoint can be hosted using Azure WebJobs. This sample is compatible with Azure WebJobs SDK 3.0.
15
13
16
14
## Running in development mode
17
15
@@ -26,17 +24,17 @@ This sample contains one project:
26
24
27
25
### Receiver
28
26
29
-
The receiver uses the self-hosting capability to start an end endpoint inside a continuously running WebJob.
27
+
The receiver uses the self-hosting capability to start an endpoint inside a WebJob.
30
28
31
29
The `UseNServiceBus` method of [`NServiceBus.Extensions.Hosting`](/nservicebus/hosting/extensions-hosting.md) is used to configure and start the endpoint:
32
30
33
31
snippet: WebJobHost_Start
34
32
35
33
> [!NOTE]
36
-
> If dependencies need to be shared between the service collection and NServiceBus infrastructure, such as message handlers, see the [ASP.NET Core sample](/samples/dependency-injection/#related-samples).
34
+
> If dependencies need to be shared between the service collection and NServiceBus infrastructure (e.g., message handlers), refer to the [ASP.NET Core sample](/samples/dependency-injection/aspnetcore).
37
35
38
-
A critical error action must be defined to restart the host when a critical error is raised:
36
+
A [critical error](/nservicebus/hosting/critical-errors.md) action must be defined to restart the host when a critical error occurs:
39
37
40
38
snippet: WebJobHost_CriticalError
41
39
42
-
When the WebJob host stops, the endpoint endpoint is automatically stopped with the host. This is taken care off by the hosting extension.
40
+
When the WebJob host stops, the endpoint is automatically stopped with it by the hosting extension.
0 commit comments