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/:
SignalRSamples– Demonstrates chat hubs, streaming, and file uploads. Key files include [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/samples/SignalRSamples/Program.cs) for host configuration and [Startup.cs](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/samples/SignalRSamples/Startup.cs) for the classic middleware pipeline.SocialWeather– Showcases custom connection handlers and stream formatters. Explore [SocialWeatherConnectionHandler.cs](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/samples/SocialWeather/SocialWeatherConnectionHandler.cs) for low-level SignalR API implementation.
HTTP and Minimal API Samples
Modern web patterns are exemplified in src/Http/samples/:
MinimalSample– Uses theWebApplicationbuilder pattern. See [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/Http/samples/MinimalSample/Program.cs) forMapGetandMapPostdelegate examples.MinimalValidationSample– Demonstrates model validation with minimal APIs in [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/Http/samples/MinimalValidationSample/Program.cs).
DataProtection Samples
Multi-instance deployment scenarios appear in src/DataProtection/samples/:
Redis– Configures key storage usingAddStackExchangeRedisCache. Reference [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/samples/Redis/Program.cs) for the implementation.EntityFrameworkCoreSample– Persists protection keys to a database via EF Core in [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs).
Infrastructure and Integration Samples
Additional specialized samples include:
- Azure App Services – Located in
src/Azure/samples/AzureAppServicesSample/, demonstrating managed identity and ASE configuration in [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/Azure/samples/AzureAppServicesSample/Program.cs). - Antiforgery –
src/Antiforgery/samples/MinimalFormSample/shows Razor Pages with automatic token validation in [Program.cs](https://github.com/dotnet/aspnetcore/blob/main/src/Antiforgery/samples/MinimalFormSample/Program.cs). - DefaultBuilder –
src/DefaultBuilder/samples/SampleApp/provides a full-stack example with static files, logging, and health checks using [Startup.cs](https://github.com/dotnet/aspnetcore/blob/main/src/DefaultBuilder/samples/SampleApp/Startup.cs). - Kestrel HTTP/2 – Low-level testing tools reside in
src/Servers/Kestrel/samples/http2cat/.
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
.csprojfile with clear entry points inProgram.csorStartup.cs. - Key demonstrations include SignalR real-time communication (
SignalRSamples), minimal APIs (MinimalSample), DataProtection with Redis (Redissample), and Azure integration (AzureAppServicesSample). - Run samples locally using
dotnet runafter 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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →