ASP.NET Core interviews blend C# fundamentals, HTTP pipeline concepts, EF Core, and security. Explain trade-offs clearly—interviewers care about reasoning, not memorized API lists.
Core topics to rehearse
- Middleware pipeline order and DI lifetimes (Scoped DbContext)
- MVC vs Razor Pages vs Web API vs minimal APIs
- EF Core: LINQ translation, Include vs projection, migrations
- Model binding, validation, and over-posting prevention
- Authentication (cookie vs JWT) and authorization policies
- Async/await for I/O-bound controller actions
Whiteboard patterns
Sketch request flow: Kestrel → middleware → routing → controller → EF query → JSON/view. Mention caching, logging, and health checks for production maturity.
Important interview questions and answers
- Q: Scoped vs Singleton DI?
A: Scoped per request (DbContext); Singleton one instance for app lifetime—never inject Scoped into Singleton. - Q: N+1 in EF Core?
A: Loop loading related data—fix with Include or project in one query. - Q: ASP.NET Core vs Django?
A: Both full-stack; ASP.NET is C#/strongly typed/.NET ecosystem; Django is Python/batteries-included admin—compare team and hosting.
Self-check
- Can you diagram middleware order from memory?
- What is dependency injection in one sentence?
Interview: Practice whiteboarding one GET endpoint: route → controller → scoped service → EF query with Include → DTO response—mention async and N+1 if you skip Include.
Interview prep
- Must-know ASP.NET interview topics?
Middleware order, DI lifetimes, MVC vs API, EF Core queries and migrations, model binding/validation, async I/O, cookie vs JWT auth—explain with request-flow examples.