ASP.NET Core Interview Question #227
An ASP.NET Core application works locally but fails in production. How would you troubleshoot it?
Senior ASP.NET Core Real-World Scenarios Senior Advanced
Quick Interview Answer
Compare the production environment with local development systematically. Verify the deployed build, runtime, environment name, configuration sources, connection strings, file permissions, certificates, network access, database schema, reverse-proxy settings, and external-service endpoints.
Detailed Explanation
Compare the production environment with local development systematically. Verify the deployed build, runtime, environment name, configuration sources, connection strings, file permissions, certificates, network access, database schema, reverse-proxy settings, and external-service endpoints.
Inspect application and hosting logs before changing code. Confirm the process starts successfully and that health checks work from the server itself. Production failures are frequently caused by configuration or infrastructure differences rather than application logic.
Avoid enabling detailed developer exception pages for public production traffic; keep diagnostics in protected logs.
Code Example
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
// Log startup/configuration diagnostics without secrets.