All questions
Showing of 67What are the advantages of using ASP.NET Core?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
ASP.NET Core is cross-platform and fast, and it ships with the core pieces most web apps need. The same app runs on Windows, Linux and macOS.
Its built-in Kestrel server is lightweight and handles many concurrent connections. The request pipeline is modular, so you add only the middleware your app needs and configure each piece.
Dependency injection is built in, which keeps classes loosely coupled and easy to unit test. Environment-based configuration, logging and security features such as authentication are built in too.
It also suits the cloud, since apps can run in Docker containers or deploy straight from Visual Studio to Azure App Service. As an open-source project, it has active community support and frequent updates.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the purpose of the Startup class?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The Startup class configures an ASP.NET Core app's services and its request pipeline when the app starts. The host calls its two methods, ConfigureServices first:
ConfigureServicesregisters services, such as MVC, EF Core and logging, with the dependency injection container.Configurebuilds the request pipeline by adding middleware in order.
Before .NET 6 every app needed one. Since .NET 6, project templates do the same setup in Program.cs with WebApplication.CreateBuilder, and there is no Startup class. A Startup class still works in newer versions, but Microsoft no longer recommends it.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What happens in the ConfigureServices method?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
ConfigureServices registers the app's services with the dependency injection container. The host calls it before Configure, so every service it adds is ready when the request pipeline is built.
Framework features such as MVC, Razor Pages and Entity Framework Core register through Add{Service} extension methods, like AddControllersWithViews and AddDbContext. Your own services go in the same place, each with a lifetime set by AddTransient, AddScoped or AddSingleton. Configuration options are usually set here too.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
}
In .NET 6 and later templates there is no ConfigureServices method. The same registrations go on builder.Services in Program.cs, before builder.Build().
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the role of the Configure method?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The Configure method builds the app's HTTP request pipeline by adding middleware components one after another. Requests pass through the middleware in the order it was added, and responses pass back in reverse order, so that order matters.
The runtime passes in an IApplicationBuilder, and each Use... call adds a component. Other services, such as IWebHostEnvironment, can be added as extra parameters, which lets the pipeline differ between Development and Production.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
else
app.UseExceptionHandler("/Home/Error");
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
Here the exception handler comes first, so it catches errors from everything after it. Authentication runs before authorization, and both sit between routing and endpoints. In .NET 6 and later, these calls follow builder.Build() in Program.cs instead.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How are application settings configured in ASP.NET Core?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
ASP.NET Core reads settings from several configuration providers and merges them into one set of key-value pairs. When two sources set the same key, the source loaded later wins.
The default sources load in this order, so each one overrides the ones before it:
appsettings.json, the main settings file.- An environment file such as
appsettings.Development.json. - User secrets, in the Development environment only.
- Environment variables.
- Command-line arguments.
So an environment variable overrides the JSON files, and a command-line argument overrides everything.
Settings are hierarchical. A key such as Logging:LogLevel:Default reads a nested JSON value, and environment variables write the colon as a double underscore. You read values through IConfiguration, or bind a section to a strongly typed class with the options pattern.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the role of the appsettings.json file?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
appsettings.json is the app's main settings file. It holds configuration data, such as connection strings and logging levels, in JSON format.
It is the base layer of configuration. An environment file such as appsettings.Production.json overrides its keys, and user secrets, environment variables and command-line arguments override both. By default both files reload when they change, so a saved edit takes effect without a restart.
Code reads a nested value with a colon path, such as Logging:LogLevel:Default. Never store passwords or other secrets in this file, because it often ends up in source control.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you set up environment-specific configurations?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Create one settings file per environment, such as appsettings.Development.json and appsettings.Production.json, and set the environment name on each machine. At startup the app loads appsettings.json first, then the file for the current environment, whose keys override the base file.
The environment name comes from the ASPNETCORE_ENVIRONMENT or DOTNET_ENVIRONMENT variable. When neither is set, the app runs as Production. Locally, the launch profile in launchSettings.json usually sets it to Development.
Code can also branch on the environment:
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
Keep secrets out of these files. Production secrets belong in a controlled store such as Azure Key Vault.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How is logging implemented in ASP.NET Core?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
ASP.NET Core logs through the built-in ILogger API. You inject ILogger<T> into a class, and the type's name becomes the log category, which helps you filter and search the logs.
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
_logger.LogInformation("Index page requested");
return View();
}
}
Each message goes to every configured logging provider. WebApplication.CreateBuilder adds the Console, Debug and EventSource providers, plus EventLog on Windows. Third-party frameworks such as Serilog or NLog plug in as providers too.
Write messages as templates with named placeholders, such as "Getting item {Id}", rather than building the string yourself. Providers then store the values as fields, which is structured logging.
Minimum levels per category go in the Logging section of appsettings.json, and the default level is Information.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the Kestrel web server?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Kestrel is the default, cross-platform web server for ASP.NET Core. It is lightweight and built for high performance, handling many concurrent connections. It supports HTTP/1.1, HTTP/2 and HTTP/3.
Kestrel can face the internet on its own, or sit behind a reverse proxy such as IIS, Nginx or Apache. Both setups are supported. A proxy adds a layer of security and configuration in production. It can also handle HTTPS certificates and load balancing, and let several apps share one IP address and port.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How does ASP.NET Core support cross-platform development?
What is the Model-View-Controller (MVC) pattern in ASP.NET Core?
What is Razor syntax?
How do you serve static files in an ASP.NET Core application?
What is the purpose of the wwwroot folder?
How do you use the IConfiguration interface?
What is the difference between AddScoped, AddTransient, and AddSingleton?
How does ASP.NET Core differ from the traditional ASP.NET Framework?
What is middleware in ASP.NET Core?
What is dependency injection (DI) in ASP.NET Core?
How does routing work in ASP.NET Core?
How do you handle exceptions in ASP.NET Core?
What are Razor Pages?
How do you create a RESTful API in ASP.NET Core?
What are Tag Helpers in ASP.NET Core?
What are View Components?
What is the difference between View Components and Partial Views?
How does model binding work in ASP.NET Core?
How do you handle form submissions in ASP.NET Core?
What is anti-forgery validation and why is it important?
What are filters in ASP.NET Core?
What is CORS and how do you configure it in ASP.NET Core?
What is SignalR?
How do you implement authentication in ASP.NET Core?
How do you implement authorization in ASP.NET Core?
What are authorization policies?
How do you secure an ASP.NET Core application?
What are Areas in ASP.NET Core MVC?
Why is the order of middleware important in ASP.NET Core?
What is endpoint routing in ASP.NET Core?
How do you create custom middleware in ASP.NET Core?
What is the role of the IApplicationBuilder interface?
What is the purpose of the IWebHost interface?
What is the difference between app.Use() and app.Run() in middleware configuration?
How do you manage service lifetimes (Singleton, Scoped, Transient) in DI?
How do you manage sensitive data in an ASP.NET Core application?
What is the IHostingEnvironment (or IWebHostEnvironment) interface used for?
How do you integrate Entity Framework Core in ASP.NET Core?
How do you manage database migrations with EF Core?
What is the Repository Pattern and why is it used?
How is session state handled in ASP.NET Core?
What is distributed caching and how can it be implemented?
What are Health Checks in ASP.NET Core?
How do you integrate Swagger (OpenAPI) into an ASP.NET Core application?
How do you deploy an ASP.NET Core application?
How do you implement globalization and localization in ASP.NET Core?
What is Blazor and how does it integrate with ASP.NET Core?
What are some of the new features in the latest version of ASP.NET Core?
What are minimal APIs in ASP.NET Core?
How do you implement custom model validation in ASP.NET Core?
What is the difference between IOptions, IOptionsSnapshot and IOptionsMonitor?
How do you decide between middleware and a filter in ASP.NET Core?
How do you implement rate limiting in an ASP.NET Core Web API?
What problem do keyed services solve in ASP.NET Core?
What is HttpContext, and why shouldn't you use it outside its request?
What is gRPC and how can it be used in ASP.NET Core?
How do you implement background tasks in ASP.NET Core?
How do you implement API versioning in ASP.NET Core Web APIs?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
ASP.NET Core in pictures.
A quick recap of ASP.NET Core in 33 short animated pictures, one idea at a time. About 8 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.
Pro The first chapter is free to play. The other 30 pictures come with Pro.
ASP.NET Core cheatsheet
- Program.cs & hosting01
- Middleware & filters02
- Dependency injection03
- Settings, secrets & logs04
- Routes & REST APIs05
- Views, Razor Pages & Blazor06
- Login, roles & security07
- EF Core, caching & sessions08
- SignalR, gRPC & background09
- Deploy, health & what's new10
- The model11
- + 5 more inside
This picture is part of Pro. The first chapter is free to play; the other 30 pictures come with Pro.
Get Pro · $10/mo Already Pro? Sign in58 of 67 ASP.NET Core answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.