Cloudstrap.Worker
0.2.0-preview.83
Prefix Reserved
dotnet add package Cloudstrap.Worker --version 0.2.0-preview.83
NuGet\Install-Package Cloudstrap.Worker -Version 0.2.0-preview.83
<PackageReference Include="Cloudstrap.Worker" Version="0.2.0-preview.83" />
<PackageVersion Include="Cloudstrap.Worker" Version="0.2.0-preview.83" />
<PackageReference Include="Cloudstrap.Worker" />
paket add Cloudstrap.Worker --version 0.2.0-preview.83
#r "nuget: Cloudstrap.Worker, 0.2.0-preview.83"
#:package Cloudstrap.Worker@0.2.0-preview.83
#addin nuget:?package=Cloudstrap.Worker&version=0.2.0-preview.83&prerelease
#tool nuget:?package=Cloudstrap.Worker&version=0.2.0-preview.83&prerelease
Cloudstrap.Worker
Worker-service bootstrap for the .NET generic host: one call gives a headless worker
validated Cloudstrap configuration (fail-fast at the call), correlation services, an additive
health-check builder, and container-probe HTTP endpoints — /healthz + /ready — that
actually reflect the registered health checks, served by a minimal internal Kestrel
side-host on a configurable port while the worker app itself gains no ASP.NET pipeline.
Quick start
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
// Optional, explicit: KeyVault configuration — call it BEFORE AddCloudstrapWorker, because the
// worker's enabled decision reads configuration at the call (see “Configuration ordering”).
builder.AddCloudstrapKeyVault();
// Explicit sibling call: Serilog + the OTel pipeline — chain .AddAzureMonitor() if wanted, and
// pick owner/contribute mode here. Deliberately NOT bundled into AddCloudstrapWorker.
builder.UseCloudstrapObservability();
// This package: validated Cloudstrap options + correlation + the health listener.
builder.AddCloudstrapWorker();
builder.Services.AddHostedService<MyWorker>();
builder.Services.AddHealthChecks()
.AddCheck("queue", () => /* your dependency check */ HealthCheckResult.Healthy(),
tags: [CloudstrapHealthCheckTags.Readiness]);
await builder.Build().RunAsync();
For unattended services, keep fatal/exit logging alive after the host's own pipeline is gone — the crash-flush pattern (guidance, deliberately not API):
CloudstrapOptions cloudstrapOptions = builder.Configuration.GetCloudstrapOptions();
using ILoggerFactory bootstrapLoggers = CloudstrapBootstrapLogger.Create(cloudstrapOptions);
ILogger startupLogger = bootstrapLoggers.CreateLogger("Startup");
try
{
await builder.Build().RunAsync();
return 0;
}
catch (Exception exception)
{
// The host's logging pipeline is disposed by RunAsync's failure path — the bootstrap
// logger is what still flushes this line.
startupLogger.LogCritical(exception, "Worker terminated unexpectedly");
return 1;
}
Settings
Owned by this package — Cloudstrap:Worker:
| Key | Default | Meaning |
|---|---|---|
HealthPort |
9000 |
The TCP port the health listener serves the probes on (1–65535). |
HealthListenAddress |
"*" |
"*" binds all interfaces — the container reality (orchestrators reach the pod address, not loopback). Set "localhost" for local development. There is no environment sniffing: this option is the whole bind decision. |
Consumed, never redefined (owned elsewhere):
| Section | Owner | Used for |
|---|---|---|
Cloudstrap:HealthChecks (Enabled, LivenessPath /healthz, ReadinessPath /ready) |
Cloudstrap.Core | The kill switch and the probe paths — the worker's probes are the same probes every Cloudstrap web host serves. |
Cloudstrap:Logging / Cloudstrap:OpenTelemetry / Cloudstrap:Correlation |
Cloudstrap.Observability (the explicit UseCloudstrapObservability() sibling call) |
Logging and telemetry. |
Cloudstrap:KeyVault |
Cloudstrap.Extensions (the explicit AddCloudstrapKeyVault() sibling call) |
Configuration source. |
Probe semantics
- Checks feed the probes through their tags (
CloudstrapHealthCheckTags.Liveness=live,.Readiness=ready): a failingready-tagged dependency check flips/readyto 503 while/healthzstays 200 — the instance leaves the load balancer without being restarted. Untagged checks are served by neither probe. - Status mapping is the framework's: Healthy and Degraded → 200 (orchestrators treat
non-503 as passing; the body says
Degraded), Unhealthy → 503. Zero matching checks → 200Healthy. - The health port serves exactly the two probe endpoints; anything else is 404. Plain HTTP, no
TLS, no authentication — the port is orchestrator-internal. A worker needing an authenticated
HTTP surface is a web host: use
Cloudstrap.WebApi. - A bind failure fails host startup naming the port — a worker never runs silently unprobed.
Cloudstrap:HealthChecks:Enabled: falseregisters no listener and never binds the port.
Configuration ordering
AddCloudstrapWorker reads Cloudstrap:HealthChecks:Enabled at the call. Configuration
sources added afterwards (for example AddCloudstrapKeyVault) do not affect that decision —
add them first.
Composability (Aspire and friends)
- Health checks are registered additively on the stock
IHealthChecksBuilder— checks added before or afterAddCloudstrapWorker, by you or by any other library, all feed the probes. - This package adds no telemetry exporter and no OTel pipeline of its own. In a
ServiceDefaults-style app keep your own pipeline and run
UseCloudstrapObservabilityin contribute mode (PipelineMode = ObservabilityPipelineMode.Contribute). - One probe owner: if your platform already hosts health endpoints for the worker, set
Cloudstrap:HealthChecks:Enabled: false— Cloudstrap's probes or the platform's, not both. - Zero
Aspire.*references, zero external packages: three sibling Cloudstrap packages plus the ASP.NET Core shared framework (already required transitively by Cloudstrap.Observability/Extensions).
Not for web hosts. A
WebApplicationalready serves these probes on its real pipeline viaUseCloudstrapWebApi/UseCloudstrapMvc(both use the sameMapCloudstrapHealthChecksimplementation). Running both would double-serve the probes on two ports.
Migrating from the source library (UseWorkerForNihdi)
| Old | New |
|---|---|
UseWorkerForNihdi() bundle (logging + KeyVault + health) |
UseCloudstrapObservability() + AddCloudstrapKeyVault() + AddCloudstrapWorker() — explicit siblings |
| Health listener answered 200 unconditionally | Probes evaluate the registered checks — readiness genuinely flips |
Hard-coded port 9000, HttpListener, URL-ACL friction |
Kestrel on Cloudstrap:Worker:HealthPort (default 9000), no ACL setup |
/health, /live, /ready |
The two standard paths from Cloudstrap:HealthChecks (/healthz, /ready), both configurable |
EnvironmentIsLocal() loopback sniffing |
Explicit HealthListenAddress option |
| Listener errors swallowed (worker ran unprobed) | Bind failure faults host startup naming the port |
Config stash (UseNihdiConfiguration) |
Dropped — resolve IOptions<CloudstrapOptions> |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AspNetCore.HealthChecks.Uris (>= 9.0.0)
- Azure.Extensions.AspNetCore.Configuration.Secrets (>= 1.5.1)
- Azure.Extensions.AspNetCore.DataProtection.Blobs (>= 1.5.3)
- Azure.Extensions.AspNetCore.DataProtection.Keys (>= 1.6.3)
- Azure.Identity (>= 1.21.0)
- Azure.Storage.Blobs (>= 12.29.1)
- Cloudstrap.Core (>= 0.2.0-preview.83)
- Cloudstrap.Extensions (>= 0.2.0-preview.83)
- Cloudstrap.Observability (>= 0.2.0-preview.83)
- OpenTelemetry.Exporter.Console (>= 1.17.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.17.0)
- OpenTelemetry.Extensions.Hosting (>= 1.17.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.17.0)
- OpenTelemetry.Instrumentation.Http (>= 1.17.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.17.0)
- OpenTelemetry.Instrumentation.SqlClient (>= 1.17.0)
- Serilog (>= 4.4.0)
- Serilog.Extensions.Hosting (>= 10.0.0)
- Serilog.Sinks.Console (>= 6.1.1)
- Serilog.Sinks.File (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-preview.83 | 37 | 9/3/2026 |
| 0.2.0-preview.2 | 64 | 8/27/2026 |