Where to Find ASP.NET Core Sample Applications in the dotnet/aspnetcore Repository

The dotnet/aspnetcore repository hosts dozens of runnable ASP.NET Core sample applications under the src/<Component>/samples/ directories, covering everything from minimal APIs to SignalR streaming and Azure integrations.

All examples in the official ASP.NET Core repository are self-contained .NET projects designed to demonstrate specific framework capabilities. These samples live alongside the source code they exercise, making them authoritative references for implementing production-grade patterns.

Sample Application Layout and Location

The ASP.NET Core samples follow a consistent organizational pattern within the repository root. Each major component maintains its own samples folder under src/<Component>/samples/, containing runnable .csproj files with entry points in Program.cs or Startup.cs.

SignalR Samples

Real-time communication examples reside in src/SignalR/samples/:

HTTP and Minimal API Samples

Modern web patterns are exemplified in src/Http/samples/:

DataProtection Samples

Multi-instance deployment scenarios appear in src/DataProtection/samples/:

Infrastructure and Integration Samples

Additional specialized samples include:

How to Clone and Run the Samples

Every sample is a standalone project requiring only the .NET SDK. Navigate to any component sample directory and execute standard CLI commands:


# Clone the repository

git clone https://github.com/dotnet/aspnetcore.git
cd aspnetcore

# Navigate to a specific sample (SignalR chat example)

cd src/SignalR/samples/SignalRSamples

# Restore dependencies and run

dotnet run

The application starts on the configured URL (typically http://localhost:5000). For the SignalR chat demo, browse to /hubs/chat to interact with the real-time endpoint.

Common configuration options:

  • Override listening addresses: --urls http://0.0.0.0:5001
  • Enable development mode: DOTNET_ENVIRONMENT=Development
  • Build for performance testing: --configuration Release

Architectural Patterns Demonstrated

The samples illustrate critical implementation patterns according to the dotnet/aspnetcore source code:

Minimal API vs. Traditional Startup – Compare src/Http/samples/MinimalSample/Program.cs (using WebApplication top-level statements) against src/SignalR/samples/SignalRSamples/Startup.cs (implementing IServiceCollection and IApplicationBuilder patterns).

Real-time Hub Design – The SignalR samples expose multiple hub types including ChatHub, Streaming, and UploadHub, demonstrating method overloads, client streaming, and file upload scenarios.

Data Protection Integration – The Redis and EF Core samples exhibit custom IStorage implementations essential for scaling across multiple server instances.

Azure-Specific Features – The Azure sample shows App Service Environment configuration, Managed Identity usage, and platform-specific logging integrations.

Summary

  • ASP.NET Core samples are located under src/<Component>/samples/ in the dotnet/aspnetcore repository.
  • Each sample contains a runnable .csproj file with clear entry points in Program.cs or Startup.cs.
  • Key demonstrations include SignalR real-time communication (SignalRSamples), minimal APIs (MinimalSample), DataProtection with Redis (Redis sample), and Azure integration (AzureAppServicesSample).
  • Run samples locally using dotnet run after navigating to the specific sample directory.
  • These implementations serve as both learning labs and production reference patterns.

Frequently Asked Questions

Where are the official ASP.NET Core samples located in the repository?

All official samples reside under the src/ directory, organized by component. For example, SignalR samples are in src/SignalR/samples/, HTTP samples in src/Http/samples/, and DataProtection samples in src/DataProtection/samples/. Each component folder contains its own samples/ subdirectory with runnable projects.

Can I run the samples without building the entire ASP.NET Core source?

Yes. Individual samples are standalone .NET projects. Navigate to any sample folder containing a .csproj file and run dotnet restore followed by dotnet run. The project will reference the stable NuGet packages unless you explicitly configure it to use local source references.

What is the difference between the MinimalSample and DefaultBuilder samples?

MinimalSample in src/Http/samples/ demonstrates the modern WebApplication builder pattern using top-level statements and minimal API endpoints. DefaultBuilder samples in src/DefaultBuilder/samples/ showcase the traditional startup configuration pattern using Startup.cs with explicit ConfigureServices and Configure methods, including full middleware pipeline setup.

Which sample demonstrates SignalR streaming capabilities?

The SignalRSamples project in src/SignalR/samples/SignalRSamples/ includes streaming hub implementations. Additionally, SocialWeather in src/SignalR/samples/SocialWeather/ demonstrates custom connection handlers and low-level streaming formatters through SocialWeatherConnectionHandler.cs.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →