ANcpSdk.AspNetCore.ServiceDefaults
1.4.2
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ANcpSdk.AspNetCore.ServiceDefaults --version 1.4.2
NuGet\Install-Package ANcpSdk.AspNetCore.ServiceDefaults -Version 1.4.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ANcpSdk.AspNetCore.ServiceDefaults" Version="1.4.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ANcpSdk.AspNetCore.ServiceDefaults" Version="1.4.2" />
<PackageReference Include="ANcpSdk.AspNetCore.ServiceDefaults" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ANcpSdk.AspNetCore.ServiceDefaults --version 1.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ANcpSdk.AspNetCore.ServiceDefaults, 1.4.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ANcpSdk.AspNetCore.ServiceDefaults@1.4.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ANcpSdk.AspNetCore.ServiceDefaults&version=1.4.2
#tool nuget:?package=ANcpSdk.AspNetCore.ServiceDefaults&version=1.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ANcpSdk.AspNetCore.ServiceDefaults
Opinionated service defaults for ASP.NET Core applications, inspired by .NET Aspire.
Features
- OpenTelemetry: Logging, metrics (ASP.NET Core, HTTP, Runtime), tracing with OTLP export
- Health Checks:
/health(readiness) and/alive(liveness) endpoints - Service Discovery: Microsoft.Extensions.ServiceDiscovery enabled
- HTTP Resilience: Standard resilience handlers with retries and circuit breakers
- JSON Configuration: CamelCase naming, enum converters, nullable annotations
- Security: Forwarded headers, HTTPS redirect, HSTS, antiforgery
- OpenAPI: Optional OpenAPI document generation
- DevLogs: Frontend console log bridge for unified debugging (Development only)
Usage
var builder = WebApplication.CreateBuilder(args);
builder.UseANcpSdkConventions();
var app = builder.Build();
app.MapANcpSdkDefaultEndpoints();
app.Run();
Configuration
builder.UseANcpSdkConventions(options =>
{
options.Https.Enabled = true;
options.OpenApi.Enabled = true;
options.AntiForgery.Enabled = false;
options.DevLogs.Enabled = true; // Default: true in Development
options.OpenTelemetry.ConfigureTracing = tracing => tracing.AddSource("MyApp");
});
DevLogs - Frontend Console Bridge
Captures browser console.log/warn/error and sends to server logs. Enabled by default in Development.
Add to your HTML (only served in Development):
<script src="/dev-logs.js"></script>
All frontend logs appear in server output with [BROWSER] prefix:
info: DevLogEntry[0] [BROWSER] User clicked button
warn: DevLogEntry[0] [BROWSER] Deprecated API called
error: DevLogEntry[0] [BROWSER] Failed to fetch data
Configuration:
options.DevLogs.Enabled = true; // Default: true
options.DevLogs.RoutePattern = "/api/dev-logs"; // Default
options.DevLogs.EnableInProduction = false; // Default: false
Auto-Registration
When used with ANcpLua.NET.Sdk.Web, service defaults are auto-registered via source generation.
Opt-out: <AutoRegisterServiceDefaults>false</AutoRegisterServiceDefaults>
License
MIT
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.AspNetCore.Diagnostics.Middleware (>= 10.1.0)
- Microsoft.AspNetCore.OpenApi (>= 10.0.1)
- Microsoft.Extensions.Compliance.Redaction (>= 10.1.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Http.Resilience (>= 10.1.0)
- Microsoft.Extensions.Logging (>= 10.0.1)
- Microsoft.Extensions.ServiceDiscovery (>= 10.1.0)
- Microsoft.Extensions.Telemetry (>= 10.1.0)
- Microsoft.Extensions.Telemetry.Abstractions (>= 10.1.0)
- OpenTelemetry.Exporter.Console (>= 1.14.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.14.0)
- OpenTelemetry.Extensions.Hosting (>= 1.14.0)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.14.0)
- OpenTelemetry.Instrumentation.Http (>= 1.14.0)
- OpenTelemetry.Instrumentation.Runtime (>= 1.14.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 |
|---|---|---|
| 999.9.9-test2 | 163 | 12/25/2025 |
| 1.4.2 | 0 | 1/1/2026 |
| 1.4.1 | 0 | 1/1/2026 |
| 1.4.0 | 0 | 1/1/2026 |
| 1.3.18 | 25 | 1/1/2026 |
| 1.3.17 | 25 | 1/1/2026 |
| 1.3.16 | 27 | 12/31/2025 |
| 1.3.15 | 32 | 12/31/2025 |
| 1.3.14 | 25 | 12/31/2025 |
| 1.3.13 | 33 | 12/31/2025 |
| 1.3.12 | 34 | 12/31/2025 |
| 1.3.10 | 40 | 12/31/2025 |
| 1.3.9 | 42 | 12/31/2025 |
| 1.3.8 | 75 | 12/30/2025 |
| 1.3.7 | 68 | 12/30/2025 |
| 1.3.6 | 72 | 12/30/2025 |
| 1.3.5 | 75 | 12/30/2025 |
| 1.3.4 | 74 | 12/30/2025 |
| 1.3.3 | 73 | 12/30/2025 |
| 1.3.2 | 77 | 12/30/2025 |
| 1.3.1 | 68 | 12/30/2025 |
| 1.3.0 | 76 | 12/30/2025 |
| 1.2.4 | 81 | 12/29/2025 |
| 1.2.3 | 79 | 12/29/2025 |
| 1.2.2 | 79 | 12/29/2025 |
| 1.2.1 | 168 | 12/25/2025 |
| 1.2.0 | 164 | 12/24/2025 |
| 1.1.8 | 269 | 12/16/2025 |
| 1.1.7 | 258 | 12/16/2025 |
| 1.0.0 | 293 | 12/15/2025 |