playground/DashboardCohosted/README.md
This example demonstrates how to cohost the Orleans Dashboard within the same web application that runs your Orleans silo.
This is the simplest way to add the Orleans Dashboard to your application. The dashboard is hosted within the same process as your silo, using ASP.NET Core minimal APIs.
WebApplication.CreateBuilder() and minimal APIsThe example shows:
WebApplication.CreateBuilder()builder.UseOrleans()siloBuilder.AddDashboard()app.MapOrleansDashboard()dotnet run
Once running, open your browser to:
var builder = WebApplication.CreateBuilder(args);
// Configure Orleans
builder.UseOrleans(siloBuilder =>
{
siloBuilder.UseLocalhostClustering();
siloBuilder.UseInMemoryReminderService();
siloBuilder.AddMemoryGrainStorageAsDefault();
// Add the dashboard
siloBuilder.AddDashboard();
});
var app = builder.Build();
// Map dashboard endpoints
app.MapOrleansDashboard();
app.Run();
Use this cohosted approach when:
app.MapOrleansDashboard(routePrefix: "/dashboard");
app.MapOrleansDashboard().RequireAuthorization();
siloBuilder.AddDashboard(options =>
{
options.CounterUpdateIntervalMs = 2000; // Update every 2 seconds
});
[!WARNING] The Orleans Dashboard is designed for development and testing scenarios only. It is not recommended for production deployments as it can have a significant performance impact on your cluster.