This guide covers common issues and their solutions when using AspNetDebugDashboard.
Possible Causes:
- Middleware not registered
- Not running in development environment
- Dashboard disabled in configuration
- Port conflicts
Solutions:
-
Check Middleware Registration:
// Ensure this is called app.UseDebugDashboard();
-
Environment Check:
// Force enable for testing app.UseDebugDashboard(forceEnable: true);
-
Configuration Check:
builder.Services.AddDebugDashboard(config => { config.IsEnabled = true; // Ensure this is true });
-
Port Conflicts:
- Check if another service is using the same port
- Try a different port:
dotnet run --urls="https://localhost:5002"
Possible Causes:
- Interceptor not registered
- DbContext not configured correctly
- SQL logging disabled
- Using raw SQL queries
Solutions:
-
Register Interceptor:
builder.Services.AddDbContext<YourDbContext>(options => { options.UseSqlServer(connectionString); options.AddDebugDashboard(builder.Services.BuildServiceProvider()); });
-
Alternative Registration:
builder.Services.AddDebugDashboardEntityFramework();
-
Enable SQL Logging:
builder.Services.AddDebugDashboard(config => { config.LogSqlQueries = true; });
-
Check EF Core Version:
- Ensure you're using EF Core 7.0+
- Update packages if necessary
Possible Causes:
- Too many entries stored
- Large request/response bodies
- Cleanup service not running
- Memory leaks in storage
Solutions:
-
Reduce Max Entries:
builder.Services.AddDebugDashboard(config => { config.MaxEntries = 500; // Reduce from default 1000 });
-
Disable Body Logging:
builder.Services.AddDebugDashboard(config => { config.LogRequestBodies = false; config.LogResponseBodies = false; });
-
Limit Body Size:
builder.Services.AddDebugDashboard(config => { config.MaxBodySize = 10 * 1024; // 10KB instead of 1MB });
-
Manual Cleanup:
// Call cleanup API endpoint POST /_debug/api/cleanup
Possible Causes:
- Too much data being logged
- Synchronous operations blocking
- Database performance issues
- Large SQL queries being logged
Solutions:
-
Exclude Heavy Endpoints:
builder.Services.AddDebugDashboard(config => { config.ExcludedPaths = new List<string> { "/_debug", "/api/heavy-operation", "/api/file-upload" }; });
-
Optimize Database Path:
builder.Services.AddDebugDashboard(config => { config.DatabasePath = "debug-dashboard.db"; // Use faster storage });
-
Reduce Logging:
builder.Services.AddDebugDashboard(config => { config.LogSqlQueries = false; // Disable if not needed });
Common Errors:
-
Missing Dependencies:
Error: Package 'LiteDB' is not foundSolution: Update to latest package version
-
Target Framework Issues:
Error: Package 'AspNetDebugDashboard' is not compatible with net6.0Solution: Upgrade to .NET 7.0+
-
Namespace Conflicts:
Error: The type 'DebugLogger' exists in both...Solution: Use fully qualified names
Common Errors:
-
Service Registration Error:
InvalidOperationException: Unable to resolve service for type 'IDebugStorage'Solution:
builder.Services.AddDebugDashboard(); // Ensure this is called
-
Database Access Error:
UnauthorizedAccessException: Access to the path 'debug-dashboard.db' is deniedSolution:
builder.Services.AddDebugDashboard(config => { config.DatabasePath = Path.Combine(Path.GetTempPath(), "debug-dashboard.db"); });
-
Middleware Order Error:
InvalidOperationException: The middleware order is incorrectSolution:
// Ensure correct order app.UseDebugDashboard(); // Should be early in pipeline app.UseRouting(); app.UseAuthorization(); app.MapControllers();
Possible Causes:
- JavaScript disabled
- HTTPS certificate issues
- Browser cache issues
- CORS problems
Solutions:
-
Enable JavaScript:
- Ensure JavaScript is enabled in your browser
- Check browser console for errors
-
HTTPS Certificate:
dotnet dev-certs https --trust
-
Clear Browser Cache:
- Hard refresh: Ctrl+F5 (Windows) or Cmd+Shift+R (Mac)
- Clear browser cache and cookies
-
Check Network Tab:
- Open browser dev tools
- Check Network tab for failed requests
- Look for 404 or 500 errors
{
"Logging": {
"LogLevel": {
"Default": "Information",
"AspNetDebugDashboard": "Debug"
}
}
}// Add this to see current configuration
app.MapGet("/debug-config", (IOptions<DebugConfiguration> config) =>
{
return Results.Ok(config.Value);
});// Check if services are registered
app.MapGet("/debug-services", (IServiceProvider services) =>
{
var storage = services.GetService<IDebugStorage>();
var logger = services.GetService<IDebugLogger>();
return Results.Ok(new
{
StorageRegistered = storage != null,
LoggerRegistered = logger != null
});
});# Test if API is accessible
curl https://localhost:5001/_debug/api/stats
# Test configuration endpoint
curl https://localhost:5001/_debug/api/configIf you're still experiencing issues:
- Check Existing Issues: Search GitHub issues
- Create New Issue: Use the bug report template
- Provide Details: Include:
- .NET version
- Package version
- Operating system
- Browser version
- Minimal reproduction code
- Error messages and stack traces
When reporting issues, please include:
// Add this endpoint to collect diagnostic info
app.MapGet("/debug-diagnostics", (IServiceProvider services) =>
{
var config = services.GetRequiredService<IOptions<DebugConfiguration>>().Value;
var env = services.GetRequiredService<IWebHostEnvironment>();
return Results.Ok(new
{
Environment = env.EnvironmentName,
Configuration = config,
DotNetVersion = Environment.Version.ToString(),
OS = Environment.OSVersion.ToString(),
MachineName = Environment.MachineName,
CurrentDirectory = Environment.CurrentDirectory
});
});To monitor the dashboard's performance impact:
// Add performance monitoring
app.Use(async (context, next) =>
{
var sw = System.Diagnostics.Stopwatch.StartNew();
await next();
sw.Stop();
if (sw.ElapsedMilliseconds > 100) // Log slow requests
{
Console.WriteLine($"Slow request: {context.Request.Path} took {sw.ElapsedMilliseconds}ms");
}
});