Preparing for a .NET developer interview requires more than memorizing definitions. You should be able to explain how C#, .NET, ASP.NET Core, SQL Server and Azure work together in a real application.
This guide covers 20 common .NET and Azure interview questions with practical answers. The answers are written so that you can understand the concept first and then explain it naturally during an interview.
1. What Is .NET?
.NET is a development platform used to build and run different types of applications, including web APIs, web applications, console applications, background services, desktop applications and cloud services.
It provides a runtime, libraries, development tools and support for languages such as C#.
Short interview answer:
.NET is Microsoft's cross-platform development platform. I primarily use it with C# to build backend services and ASP.NET Core Web APIs.
2. What Is the Difference Between C# and .NET?
C# is a programming language, while .NET is the development platform used to build and execute applications.
A simple way to remember the difference is:
C# = Programming language
.NET = Development platform
You write application logic using C#, while .NET provides the runtime, libraries and tooling required by the application.
3. What Is ASP.NET Core?
ASP.NET Core is the modern web framework in the .NET ecosystem. It is commonly used to build:
- REST APIs
- MVC applications
- Razor Pages applications
- Blazor applications
- Microservices
- Backend services
It includes features such as dependency injection, middleware, configuration, logging, authentication, authorization and routing.
4. What Is Dependency Injection?
Dependency Injection, or DI, is a technique in which a class receives the dependencies it needs instead of creating those dependencies itself.
For example:
public class OrderService
{
private readonly IOrderRepository _repository;
public OrderService(IOrderRepository repository)
{
_repository = repository;
}
}
Here, OrderService receives an
IOrderRepository through its constructor.
This reduces tight coupling and makes the code easier to test and maintain.
5. What Are Singleton, Scoped and Transient Lifetimes?
ASP.NET Core's dependency injection container supports different service lifetimes.
| Lifetime | Behavior |
|---|---|
| Transient | A new service instance is provided each time it is requested. |
| Scoped | One instance is normally used within an HTTP request scope. |
| Singleton | One instance is used for the lifetime of the application container. |
Registration examples:
builder.Services.AddTransient<IEmailService, EmailService>();
builder.Services.AddScoped<IOrderService, OrderService>();
builder.Services.AddSingleton<ICacheService, CacheService>();
6. What Is Middleware in ASP.NET Core?
Middleware is software that participates in the ASP.NET Core HTTP request/response pipeline.
A simplified request flow is:
HTTP Request
↓
Exception Handling
↓
HTTPS Redirection
↓
Routing
↓
Authentication
↓
Authorization
↓
Endpoint
↓
HTTP Response
Middleware can perform tasks such as logging, exception handling, authentication, authorization and routing.
7. What Is the Difference Between Authentication and Authorization?
Authentication determines who the user is.
Authorization determines what an authenticated user is allowed to access.
For example:
Authentication:
"Who are you?"
Authorization:
"Are you allowed to access this resource?"
An application may authenticate a user with a token and then use roles or policies to determine which endpoints that user can access.
8. What Is JWT Authentication?
JWT stands for JSON Web Token.
A common API authentication flow is:
User sends credentials
↓
Server validates credentials
↓
Server issues JWT
↓
Client sends JWT with later requests
↓
API validates JWT
↓
Protected resource is accessed
The client commonly sends the token using the HTTP Authorization header:
Authorization: Bearer <token>
JWTs can contain claims such as user identifiers and roles. Tokens should have appropriate expiration and signing validation.
9. What Is Entity Framework Core?
Entity Framework Core, or EF Core, is a data-access technology for .NET. It allows developers to work with databases using .NET objects and LINQ.
For example:
var activeUsers = await context.Users
.Where(user => user.IsActive)
.ToListAsync();
EF Core supports features such as change tracking, relationships, migrations, LINQ queries and asynchronous database operations.
10. What Is LINQ?
LINQ stands for Language Integrated Query. It provides a consistent query syntax for working with collections and supported data sources.
Example:
var adults = people
.Where(person => person.Age >= 18)
.OrderBy(person => person.Name)
.ToList();
With EF Core, LINQ expressions can often be translated into SQL and executed by the database.
11. What Is SQL Server?
SQL Server is Microsoft's relational database management system. It is commonly used with .NET applications to store structured application data.
Important SQL Server concepts for .NET developers include:
- Tables and relationships
- Primary and foreign keys
- Indexes
- Joins
- Stored procedures
- Transactions
- Query optimization
In a typical ASP.NET Core application, SQL Server can be accessed through EF Core, ADO.NET or another data-access library.
12. What Is Azure App Service?
Azure App Service is a managed Azure service for hosting web applications, APIs and related workloads without managing the underlying servers in the same way as traditional virtual machines.
For an ASP.NET Core API, a typical deployment could look like:
Developer
↓
Source Repository
↓
CI/CD Pipeline
↓
Azure App Service
↓
Azure SQL Database
App Service provides capabilities such as deployment slots, scaling, configuration settings, TLS support and integration with other Azure services.
13. What Is Azure SQL Database?
Azure SQL Database is a managed relational database service in Azure based on SQL Server technology.
Microsoft manages much of the underlying infrastructure, including built-in high availability and automated backup capabilities depending on the chosen configuration.
An application can connect using a standard SQL connection string or supported identity-based authentication.
14. What Is an Azure Virtual Machine?
An Azure Virtual Machine provides virtualized computing infrastructure in Azure.
Unlike a highly managed platform service such as App Service, a VM gives you more control over the operating system and installed software, but also requires more management.
| Azure App Service | Azure VM |
|---|---|
| Managed application hosting platform | Virtualized server environment |
| Less OS management | More OS-level control and responsibility |
| Useful for supported web/API workloads | Useful when OS-level control or specific software is required |
15. What Is Azure Storage?
Azure Storage provides several cloud storage services for different types of data.
| Service | Typical Purpose |
|---|---|
| Blob Storage | Object storage for files and unstructured data |
| Azure Files | Managed file shares |
| Queue Storage | Message queues |
| Table Storage | NoSQL key/attribute data |
For example, an ASP.NET Core application might store uploaded documents in Blob Storage instead of storing large files directly inside a SQL database.
16. How Does Dependency Injection Improve Testability?
Dependency injection allows a class to depend on an abstraction rather than creating a concrete dependency internally.
Consider:
public class PaymentService
{
private readonly IPaymentGateway _gateway;
public PaymentService(IPaymentGateway gateway)
{
_gateway = gateway;
}
}
During production, the application can inject the real payment gateway. During a unit test, a test implementation or mock can be supplied.
This makes the class easier to test in isolation.
17. Why Is Middleware Order Important?
ASP.NET Core executes middleware in the order it is added to the pipeline.
For example:
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
Authentication needs to run before authorization when authorization depends on the authenticated user's identity.
Incorrect middleware ordering can cause unexpected behavior, including authentication and authorization failures.
18. What Is Routing in ASP.NET Core?
Routing matches incoming HTTP requests to application endpoints.
For example:
[ApiController]
[Route("api/[controller]")]
public class ProductsController : ControllerBase
{
[HttpGet("{id:int}")]
public IActionResult GetById(int id)
{
return Ok(id);
}
}
A request such as:
GET /api/products/10
can be matched to the GetById() endpoint.
19. How Does Configuration Work in ASP.NET Core?
ASP.NET Core supports configuration from multiple providers. Common sources include:
- appsettings.json
- Environment-specific appsettings files
- Environment variables
- Command-line arguments
- External configuration providers
For example:
{
"ApiSettings": {
"BaseUrl": "https://api.example.com"
}
}
The value can be read through configuration:
var baseUrl =
builder.Configuration["ApiSettings:BaseUrl"];
Sensitive production secrets should not be committed directly to source control in configuration files.
20. How Does Logging Work in .NET?
.NET provides a logging abstraction that allows application components to write structured log messages.
For example:
public class OrderService
{
private readonly ILogger<OrderService> _logger;
public OrderService(ILogger<OrderService> logger)
{
_logger = logger;
}
public void Process(int orderId)
{
_logger.LogInformation(
"Processing order {OrderId}",
orderId);
}
}
Common log levels include:
Trace
Debug
Information
Warning
Error
Critical
Production applications can send logs to different providers and monitoring platforms depending on the environment.
Scenario-Based Interview Questions
Once you understand definitions, interviewers may ask how you would apply them in a real application.
Your API Is Slow. How Would You Investigate It?
I would first measure where the time is being spent instead of immediately changing the code.
I would check areas such as:
- Database query execution time
- External API calls
- Sequential operations that could safely run concurrently
- Large response payloads
- Repeated database calls
- Logging and application telemetry
- CPU and memory utilization
After identifying the bottleneck, I would optimize that area and measure the result again.
Where Should You Store Application Secrets in Azure?
Secrets should not be hardcoded in source code or committed to a Git repository.
Depending on the application, sensitive values can be stored using services such as Azure Key Vault and accessed through an appropriate identity and permission model.
When Would You Use Azure App Service Instead of a VM?
For a supported web application or API, I would generally consider App Service when I want a managed hosting platform and don't need direct control over the underlying operating system.
I would consider a VM when the workload requires greater OS-level control, specific server software, or configuration that isn't suitable for the managed platform.
What Happens When an ASP.NET Core Request Arrives?
A simplified explanation is:
Client
↓
HTTP Request
↓
ASP.NET Core Server
↓
Middleware Pipeline
↓
Routing
↓
Authentication / Authorization
↓
Endpoint
↓
Application / Data Layer
↓
HTTP Response
The exact pipeline depends on how the application is configured.
How to Answer .NET Interview Questions Better
For experienced developers, a strong answer usually combines the definition with practical experience.
Instead of saying only:
Dependency injection reduces coupling.
You could explain:
I use constructor injection in ASP.NET Core services. For example, a controller can depend on an IOrderService rather than constructing OrderService directly. That keeps the controller loosely coupled and makes it easier to replace the service during testing.
That demonstrates both conceptual and practical understanding.
Frequently Asked Questions
Are these questions enough for a .NET interview?
They cover important fundamentals, but experienced .NET interviews can also include C# internals, SOLID principles, async/await, LINQ, microservices, testing, SQL optimization, design patterns, security and system design.
Should I memorize interview answers?
No. Understand the concept well enough to explain it naturally. Interviewers can usually identify memorized answers when they ask follow-up or scenario-based questions.
Should a .NET developer learn Azure?
Cloud knowledge is valuable for developers working on modern hosted applications. At minimum, understanding application hosting, storage, databases, identity, monitoring and deployment can be useful.
Do I need SQL for .NET interviews?
Many backend .NET roles involve relational databases, so understanding SQL queries, joins, indexes, transactions and basic query optimization is useful.
What should an experienced .NET developer prepare?
In addition to fundamentals, prepare examples from real projects: performance problems you solved, production incidents, architecture decisions, API security, database optimization, testing, deployments and trade-offs you considered.
Conclusion
A successful .NET interview requires understanding how the technologies fit together rather than memorizing isolated definitions.
Start with C#, .NET and ASP.NET Core fundamentals, then strengthen your knowledge of dependency injection, middleware, authentication, EF Core and SQL Server.
For cloud-focused roles, also be prepared to explain when and why you would use services such as Azure App Service, Azur