ASP.NET Core interview questions test the request pipeline (middleware and why its order matters), dependency injection lifetimes, routing with minimal APIs or controllers, configuration and options, and how the app is hosted, secured and tested. Know which .NET you are talking about: Microsoft's official .NET release index, checked November 17, 2026, lists .NET 11 (standard-term support, released November 10, 2026) and .NET 10 (long-term support) as active, both supported until November 14, 2028, while .NET 8 and .NET 9 reached end of support on November 10, 2026.
Below are 30 questions by level, five troubleshooting scenarios and how interviews test this. Runtime and language ground is in .NET interview questions and C# interview questions.
ASP.NET Core interview questions: fundamentals (1–10)
- What is ASP.NET Core? Microsoft's cross-platform, open-source framework for web apps and APIs on .NET. It runs on the Kestrel server and hosts minimal APIs, MVC controllers, Razor Pages, Blazor, SignalR and gRPC.
- What is middleware? A component in the request pipeline that can handle the request, call the next component and act on the response:
app.Use(async (context, next) => { /* before */ await next(context); /* after */ }); - Use, Run or Map?
Useadds middleware that can call the next one;Runadds terminal middleware;Mapbranches the pipeline by path. - Why does middleware order matter? Each component only sees what earlier ones let through. A typical order: exception handling, HSTS, HTTPS redirection, static files, routing, CORS, authentication, authorization, then endpoints. Authorization before authentication means every user is anonymous.
- What is Kestrel? The built-in, cross-platform web server. It can face the internet directly or run behind a reverse proxy such as IIS, Nginx or YARP, which can add TLS termination, load balancing and other edge features.
- What are the DI lifetimes? Singleton (one instance for the app), scoped (one per request), transient (new on every resolve), registered with
AddSingleton,AddScopedandAddTransient. - What is a captive dependency? A longer-lived service holding a shorter-lived one, such as a singleton that takes a scoped
DbContext, which then lives forever and is shared across requests. Scope validation in the Development environment throws for this at startup. - What does Program.cs look like?
var builder = WebApplication.CreateBuilder(args);registers services onbuilder.Services;var app = builder.Build();adds middleware and endpoints such asapp.MapGet("/ping", () => "pong");;app.Run();starts it. - How does configuration layer? By default:
appsettings.json, thenappsettings.{Environment}.json, user secrets in Development, environment variables, then command-line arguments, with later sources overriding earlier ones. Nested keys use:, or__in environment variables. - How are environments set? With
ASPNETCORE_ENVIRONMENT(Development, Staging, Production; Production if unset), checked throughapp.Environment.IsDevelopment().
Intermediate ASP.NET Core questions (11–20)
- IOptions, IOptionsSnapshot or IOptionsMonitor? Bind a section with
builder.Services.Configure<SmtpOptions>(builder.Configuration.GetSection("Smtp")).IOptionsis a singleton read once;IOptionsSnapshotis scoped and recomputed per request;IOptionsMonitoris a singleton with change notifications. AddValidateOnStart()to fail fast. - Minimal APIs or controllers? Minimal APIs map handlers directly (
MapGet,MapPost,MapGroup) with endpoint filters: less ceremony, good for small services. Controllers add[ApiController]conventions, attribute routing and MVC filters, which suit large APIs. Both share routing, DI and auth. - How does routing work? Endpoint routing matches a request to an endpoint, then the endpoint runs. Templates take constraints such as
{id:int}; controllers use attributes such as[Route("api/[controller]")]; route groups share prefixes and policies. - How do model binding and validation work? Values bind from route, query, headers, form or body (
[FromBody]). With[ApiController], invalid DataAnnotations produce an automatic 400 with validation problem details. Since .NET 10, minimal APIs get built-in validation afterbuilder.Services.AddValidation(). - Filters or middleware? Middleware sees every request but knows nothing about MVC. Filters (authorization, resource, action, exception, result) run inside MVC with access to action arguments and model state; minimal APIs use endpoint filters. Use middleware for cross-cutting HTTP concerns, filters for action-level ones.
- Authentication versus authorization? Authentication establishes who the caller is (cookies, JWT bearer, OpenID Connect); authorization decides what they may do with
[Authorize], roles or policies built from requirements and handlers, such as.RequireAuthorization("AdminOnly"). - What should JWT validation check? Issuer, audience, lifetime and signing key. Tokens are stateless, so revocation is hard; keep access tokens short-lived and use refresh tokens.
- How do you configure CORS? Register a policy with
AddCorsand apply it withUseCorsor per endpoint. The CORS specification does not allow a wildcard origin together with credentials, so list origins explicitly. - How do you handle errors globally?
UseExceptionHandlerwith anIExceptionHandlerimplementation (added in .NET 8) andAddProblemDetails()for RFC-style error bodies. Use the developer exception page only in Development. - Why IHttpClientFactory?
new HttpClient()per call can exhaust sockets, and one static client can miss DNS changes. The factory pools handlers and supports named and typed clients;Microsoft.Extensions.Http.Resilienceadds retries, timeouts and circuit breakers.
Experienced and senior ASP.NET Core questions (21–30)
- How do async and the thread pool interact?
awaitreleases the thread during I/O. Blocking on tasks with.Resultor.Wait()holds threads and can starve the pool under load, so go async all the way and passHttpContext.RequestAbortedas the cancellation token. - How do you run background work? Subclass
BackgroundService(anIHostedService). To use scoped services such as aDbContext, create a scope withIServiceScopeFactory. AChannel<T>gives an in-process queue; work that must survive restarts needs a real queue. - What caching options are built in?
IMemoryCachein-process,IDistributedCachebacked by Redis or SQL, output caching middleware (added in .NET 7) for whole responses, andHybridCache, one API over memory and distributed caches with stampede protection. - How do you rate-limit? The built-in rate limiting middleware (.NET 7 onward):
AddRateLimiterwith fixed window, sliding window, token bucket or concurrency limiters, applied withUseRateLimiterandRequireRateLimiting("policy"). - How do health checks work?
builder.Services.AddHealthChecks()with checks for dependencies, andapp.MapHealthChecks("/healthz"). In Kubernetes, separate liveness (the process is up) from readiness (dependencies reachable). - How should you log? Inject
ILogger<T>and use message templates,logger.LogInformation("Order {OrderId} paid", id), not string interpolation, so logs stay structured. Add OpenTelemetry for traces and metrics. - How do you generate OpenAPI documents? Since .NET 9, with the built-in
Microsoft.AspNetCore.OpenApipackage:builder.Services.AddOpenApi()andapp.MapOpenApi(). .NET 10 generates OpenAPI 3.1 documents. - How do you integration-test an API?
WebApplicationFactory<Program>fromMicrosoft.AspNetCore.Mvc.Testingruns the app in memory with a real pipeline; swap dependencies withConfigureTestServicesand call it through the providedHttpClient. - How do you improve throughput and startup? Async I/O everywhere, no synchronous body reads, caching, response compression, pooled objects, fewer allocations on hot paths, and Native AOT for minimal APIs when fast startup and small memory matter, accepting its feature limits.
- What should you know about .NET versions in 2026? .NET 10 is the LTS most teams target; .NET 11 shipped November 10, 2026 as an STS release; .NET 8 and 9 left support the same day. .NET 10 also added Server-Sent Events support and passkey support in ASP.NET Core Identity.
ASP.NET Core scenario and troubleshooting questions
Requests hang under load while CPU stays low. Classic thread pool starvation from sync-over-async: .Result or .Wait() in a hot path. Confirm with dotnet-counters (thread pool queue length), then make the call chain async.
Startup throws: cannot consume a scoped service from a singleton. A captive dependency. Make the consumer scoped, or have the singleton create a scope with IServiceScopeFactory each time it needs the scoped service.
Every call returns 401 with a valid token. Check that UseAuthentication runs before UseAuthorization, that the token's issuer and audience match validation settings, the clock, and the authentication scheme. The JWT handler's logs usually name the failure.
The browser reports a CORS error but Postman works. CORS is enforced only by browsers. Check that the policy is applied, that UseCors sits in the right place, that the origin matches exactly including scheme and port, and that preflight OPTIONS requests are allowed.
Calls to a partner API fail with socket errors under load. A new HttpClient per request. Move to IHttpClientFactory with a typed client and add timeouts and retries through the resilience handler.
How ASP.NET Core interviews test this
| Format | What it usually looks like | How to prepare |
|---|---|---|
| Concept Q&A | Middleware order, DI lifetimes, options, auth, minimal APIs versus controllers | Explain each with a Program.cs line |
| Live build | A small CRUD API with validation and an error handler, sometimes with tests | Build one from an empty project in under an hour |
| Code review | Spot a captive dependency, .Result or a misplaced middleware call | Practice reading Program.cs critically |
| Senior design | Auth, caching, resilience, observability and versioning for a public API | Tie answers to REST API design |
Data access almost always follows; see Entity Framework interview questions.
Where CoPilot Interview fits
CoPilot Interview is an AI interview assistant. Its free AI mock interview builds ASP.NET Core and .NET questions from your résumé and the job description, reads them aloud and scores each spoken answer out of 10, which is a fast way to find the answers above that you know but cannot yet explain cleanly under pressure. The browser demo has 145 practice questions in 10 tracks, scores typed answers out of 10 and needs no signup. The free plan gives 15 minutes a day of live help in sessions of up to 15 minutes, with AI mock interviews included. Paid plans are Standard at $24.99 a month and Pro at $39.99 a month, in the desktop app for Windows 10/11 and macOS 12 or later.
Use it to practice. Online assessments, proctored tests, take-home tasks with rules and AI-led rounds forbid outside help, so prepare for those instead of bringing a tool. For any live interview, follow your employer's rules.
Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly.
Frequently asked questions
What are the most common ASP.NET Core interview questions?
Middleware and its order, DI lifetimes (singleton, scoped, transient), minimal APIs versus controllers, the options pattern, authentication versus authorization, filters, IHttpClientFactory and async best practices.
What is the difference between AddSingleton, AddScoped and AddTransient?
AddSingleton creates one instance for the app's lifetime, AddScoped one per request, and AddTransient a new instance every time the service is resolved.
Should I use minimal APIs or controllers?
Minimal APIs for small, focused services and new projects that value less ceremony; controllers for large APIs that benefit from conventions and MVC filters. Interviewers mainly want you to justify the choice.
Which .NET version should I know for interviews?
.NET 10, the current LTS. As of November 17, 2026, .NET 11 has also shipped (November 10, 2026), and .NET 8 and 9 are out of support.
What is middleware in ASP.NET Core?
A component in the request pipeline that can inspect or change the request, call the next component, and inspect or change the response on the way back.
Practice this interview before the real one
The AI mock interview builds questions from your resume and the job description, reads them aloud and scores each spoken answer out of 10. Included on the free plan.
Start a mock interview