Installation
This page provides detailed instructions for installing and setting up AsyncEndpoints in your .NET application.
Prerequisites
Before installing AsyncEndpoints, ensure your development environment meets the following requirements:
- .NET Runtime: .NET 8.0 or .NET 9.0 (the library is built for both target frameworks)
- Development Tools: Visual Studio 2022, Visual Studio Code, or equivalent IDE
- Package Manager: NuGet package manager (ships with .NET)
The library supports both development and production scenarios with optional Redis integration for distributed deployments.
Installing Core Package
The core AsyncEndpoints package provides all the essential functionality for creating asynchronous endpoints. Install it using one of these methods:
Using .NET CLI
dotnet add package AsyncEndpoints
Using Package Manager Console
Install-Package AsyncEndpoints
Using PackageReference
<PackageReference Include="AsyncEndpoints" Version="1.1.1-alpha" />
Installing Redis Extension (Optional)
For production deployments with distributed processing and persistence, install the Redis extension:
Using .NET CLI
dotnet add package AsyncEndpoints.Redis
Using Package Manager Console
Install-Package AsyncEndpoints.Redis
Using PackageReference
<PackageReference Include="AsyncEndpoints.Redis" Version="1.1.1-alpha" />
Verify Installation
After installation, you can verify the package is properly added by creating a minimal working example:
using AsyncEndpoints;
using Microsoft.AspNetCore.Builder;
var builder = WebApplication.CreateBuilder(args);
// Add core AsyncEndpoints services
builder.Services
.AddAsyncEndpoints() // Core services
.AddAsyncEndpointsInMemoryStore() // Development storage
.AddAsyncEndpointsWorker(); // Background processing
var app = builder.Build();
// Define a simple async endpoint
app.MapAsyncPost<SimpleRequest>("SimpleJob", "/api/simple-job");
app.MapAsyncGetJobDetails("/jobs/{jobId:guid}"); // Job status endpoint
// Simple request model
public class SimpleRequest
{
public string Message { get; set; } = string.Empty;
}
app.Run();
Package Contents
The core package includes:
- Core Services: Job management, background processing, and state management
- HTTP Integration: Extension methods for mapping async endpoints
- Storage Interfaces: Abstract storage layer with in-memory implementation
- Configuration: Flexible configuration system with defaults
- Utilities: Helper classes and error handling utilities
- Serialization: Built-in serialization support
The Redis extension package includes:
- Redis Storage: Production-ready Redis-based job storage
- Distributed Recovery: Automatic recovery for stuck jobs in multi-instance deployments
- Connection Management: Robust Redis connection handling with reconnection logic
- Lua Scripts: Optimized Lua scripts for atomic operations
Common Installation Issues
Target Framework Mismatch
If you encounter target framework errors, ensure your project targets .NET 8.0 or .NET 9.0:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project>
Missing Dependencies
AsyncEndpoints requires the following .NET components:
Microsoft.AspNetCore.Appframework reference- .NET 8.0 or 9.0 SDK
Next Steps
After successful installation, continue to the Quick Start guide to learn how to implement your first async endpoint.