20 Dot Net Core
Interview Question
1. What is .NET Core, and how does it
differ from the .NET Framework?
.NET Core is a cross-platform, open-
source framework for building
applications. Unlike the .NET
Framework, it supports multiple
platforms (Windows, macOS, Linux) and
is modular.
2. Explain the key features of .NET
Core.
Key features include cross-platform
support, high performance, modular
architecture, side-by-side versioning,
and cloud-native capabilities.
3. What is the role of the .NET Core
CLI (Command-Line Interface)?
The CLI is a tool for creating, building,
running, and publishing .NET Core
applications from the command line.
4. How does dependency injection
work in .NET Core?
Dependency injection is built-in.
Services are registered in the Startup
class and injected into controllers or
other components.
5. What is middleware in ASP.NET
Core, and how is it implemented?
Middleware is software that processes
requests and responses in the
application pipeline. It is implemented
using the UseMiddleware method.
6. Can you explain the concept of
routing in ASP.NET Core?
Routing maps incoming requests to
specific endpoints. It is configured in
the Startup class using UseRouting and
UseEndpoints.
7. What are the differences between
Kestrel and IIS in .NET Core?
Kestrel is a lightweight, cross-platform
web server. IIS is a full-featured
Windows web server. Kestrel is often
used as an edge server or behind IIS.
8. How does .NET Core support
cross-platform development?
It uses a runtime that works on multiple
operating systems and provides
platform-specific libraries.
9. What is the purpose of the
appsettings.json file in .NET Core?
It stores configuration settings like
connection strings and app-specific
settings.
10. How do you handle configuration
in .NET Core applications?
Configuration is handled using the
IConfiguration interface and can be
loaded from JSON files, environment
variables, or command-line arguments.
11. What is Entity Framework Core,
and how does it integrate with .NET
Core?
EF Core is an ORM for .NET Core. It
integrates by allowing developers to
work with databases using .NET objects.
12. Explain the concept of logging in
.NET Core.
Logging is built-in and supports multiple
providers like Console, Debug, and
third-party tools.
13. How do you implement
authentication and authorization in
.NET Core?
Authentication is implemented using
middleware like AddAuthentication.
Authorization is handled using policies
and roles.
14. What is the difference between
AddSingleton, AddScoped, and
AddTransient in dependency
injection?
• AddSingleton: Single instance for the
app's lifetime.
• AddScoped: Instance per request.
• AddTransient: New instance every
time it's requested.
15. How do you create and use custom
middleware in ASP.NET Core?
Create a class with an Invoke method
and register it in the pipeline using
UseMiddleware.
16. What is the purpose of the Startup
class in .NET Core?
It configures services and the request
pipeline for the application.
17. How does .NET Core handle
versioning and side-by-side
execution?
Multiple versions of .NET Core can run
on the same machine, allowing apps to
use specific versions.
18. What are the benefits of using
.NET Core for microservices
architecture?
Benefits include lightweight runtime,
cross-platform support, and integration
with Docker and Kubernetes.
19. How do you deploy a .NET Core
application to a cloud platform like
Azure?
Deploy using tools like Azure DevOps,
Visual Studio, or the Azure CLI.
20. What are some common
performance optimization techniques
in .NET Core?
Techniques include caching,
asynchronous programming, minimizing
middleware, and optimizing database