How would you explain the architecture of a production ASP.NET Core application in a senior interview?
Quick Interview Answer
Detailed Explanation
Start from the request boundary and explain responsibilities rather than listing technologies. Describe how traffic reaches the host, how middleware handles cross-cutting concerns, how routing reaches controllers or endpoints, and how application services coordinate business use cases.
Explain data access, external integrations, authentication and authorization, caching, background processing, configuration, and observability. Then discuss why dependency boundaries and lifetimes were chosen, how the system scales, how failures are handled, and how it is tested and deployed.
A senior-level answer should include trade-offs. There is rarely one universally correct architecture; the design should follow the system's scale, team, reliability, security, and business requirements.
Code Example
// Typical dependency direction:
// HTTP/UI -> Application services -> Domain rules
// -> Data/integration abstractions
// Infrastructure implements external concerns.
builder.Services.AddControllersWithViews();
builder.Services.AddScoped<IOrderService, OrderService>();
builder.Services.AddScoped<IOrderRepository, OrderRepository>();
builder.Services.AddHttpClient<PaymentClient>();