How does dependency injection work in ASP.NET Core?
ASP.NET Core includes a built-in dependency injection container. Services are registered in IServiceCollection during application startup and are resolved from IServiceProvider when required.
C# interview questions covering asp.net core, di & middleware.
Open a question for the full answer, code and interview guidance.
ASP.NET Core includes a built-in dependency injection container. Services are registered in IServiceCollection during application startup and are resolved from IServiceProvider when required.
Middleware is software assembled into the HTTP request pipeline. Each middleware component can inspect or modify the request, perform work before and after the next component, and optionally terminate the pipeline.
Middleware operates at the HTTP pipeline level and can apply broadly to requests regardless of MVC or controller execution.
ASP.NET Core configuration combines settings from providers such as appsettings.json, environment-specific JSON files, environment variables, command-line arguments, user secrets during development, and external configuration systems.
The Options Pattern maps configuration sections to strongly typed C# classes.
ASP.NET Core provides the ILogger<T> abstraction for structured application logging.
Global exception handling centralizes the conversion of unhandled exceptions into consistent HTTP responses and logs.
Model binding converts incoming HTTP request data into C# action parameters or model objects.
Model validation verifies that incoming data satisfies declared validation rules.
Authentication determines who the user is. Authorization determines what an authenticated or anonymous user is allowed to do.