Miccore.Net.ServiceDefaults 1.0.0

dotnet add package Miccore.Net.ServiceDefaults --version 1.0.0
                    
NuGet\Install-Package Miccore.Net.ServiceDefaults -Version 1.0.0
                    
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="Miccore.Net.ServiceDefaults" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Miccore.Net.ServiceDefaults" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Miccore.Net.ServiceDefaults" />
                    
Project file
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 Miccore.Net.ServiceDefaults --version 1.0.0
                    
#r "nuget: Miccore.Net.ServiceDefaults, 1.0.0"
                    
#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 Miccore.Net.ServiceDefaults@1.0.0
                    
#: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=Miccore.Net.ServiceDefaults&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Miccore.Net.ServiceDefaults&version=1.0.0
                    
Install as a Cake Tool

Miccore.Clean.ServiceDefaults

NuGet NuGet Downloads License: MIT

Shared service defaults for .NET Aspire applications including OpenTelemetry, Health Checks, Resilience, and Service Discovery configurations.

Features

  • 📊 OpenTelemetry Integration - Complete telemetry setup with logging, metrics, and tracing
  • 🏥 Health Checks - Pre-configured health check endpoints (/health and /alive)
  • 🔄 Resilience - HTTP resilience handlers with retry policies
  • 🔍 Service Discovery - Built-in service discovery support
  • 🌐 Gateway Extensions - API Gateway specific configurations (caching, compression)

Supported Frameworks

  • .NET 8.0
  • .NET 9.0
  • .NET 10.0

Installation

dotnet add package Miccore.Clean.ServiceDefaults

Or via Package Manager Console:

Install-Package Miccore.Clean.ServiceDefaults

Quick Start

1. Add Service Defaults to your application

In your Program.cs:

var builder = WebApplication.CreateBuilder(args);

// Add service defaults (OpenTelemetry, Health Checks, Service Discovery, Resilience)
builder.AddServiceDefaults();

// Add your other services...
builder.Services.AddControllers();

var app = builder.Build();

// Map default endpoints (health checks)
app.MapDefaultEndpoints();

// Map your other endpoints...
app.MapControllers();

app.Run();

2. Available Extension Methods

AddServiceDefaults()

Configures the complete set of service defaults:

builder.AddServiceDefaults();

This includes:

  • OpenTelemetry (logging, metrics, tracing)
  • Health checks
  • Service discovery
  • HTTP resilience
MapDefaultEndpoints()

Maps the health check endpoints:

app.MapDefaultEndpoints();

Exposes:

  • /health - Full health check
  • /alive - Liveness probe

3. Gateway-Specific Configuration

For API Gateway services, use additional gateway extensions:

builder.AddServiceDefaults();
builder.AddGatewayDefaults(); // Adds caching, compression, etc.

Configuration

OpenTelemetry

The package automatically configures OpenTelemetry based on environment variables:

Variable Description
OTEL_EXPORTER_OTLP_ENDPOINT OTLP exporter endpoint
OTEL_SERVICE_NAME Service name for telemetry

Health Checks

Health check endpoints are automatically mapped:

  • /health - Returns detailed health status
  • /alive - Simple liveness check for Kubernetes probes

Example: Complete Setup

using Miccore.Clean.ServiceDefaults;

var builder = WebApplication.CreateBuilder(args);

// Add all service defaults
builder.AddServiceDefaults();

// Add application services
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure pipeline
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

// Map health endpoints
app.MapDefaultEndpoints();

// Map your API endpoints
app.MapGet("/api/hello", () => "Hello World!");

app.Run();

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please open an issue on GitHub.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.

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
1.0.0 631 12/15/2025