Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views8 pages

Interview Questions Dot Net Core

.NET Core is a free, open-source, cross-platform framework developed by Microsoft for building modern applications. Key topics covered include differences between .NET Core and .NET Framework, middleware, dependency injection, routing, and API security. The document also highlights various components and features such as Kestrel, logging, and minimal APIs introduced in .NET 6+.

Uploaded by

Akash Londhe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Interview Questions Dot Net Core

.NET Core is a free, open-source, cross-platform framework developed by Microsoft for building modern applications. Key topics covered include differences between .NET Core and .NET Framework, middleware, dependency injection, routing, and API security. The document also highlights various components and features such as Kestrel, logging, and minimal APIs introduced in .NET 6+.

Uploaded by

Akash Londhe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Top 20 .

NET Core
Interview Questions

1. What is .NET Core?


A free, open-source, cross-platform
framework developed by Microsoft for
building modern apps (web, desktop, cloud,
IoT, etc.).

2. What are the main differences


between .NET Core and .NET Framework?
• Cross-platform (.NET Core is, .NET
Framework isn't)
• Modular and lightweight
• Open-source
• No Web Forms in .NET Core

3. What is the Startup.cs file used for?


It configures services (ConfigureServices)
and the app's HTTP request pipeline
(Configure).

4. What is Middleware in .NET Core?


Middleware are software components
assembled into the app pipeline to handle
requests and responses.

5. What is the use of appsettings.json?


Used to store configuration settings (like DB
strings, logging levels) in key-value format.
6. What is Dependency Injection in .NET
Core?
Built-in design pattern that injects required
dependencies into classes rather than
creating them directly.

7. What are the different service


lifetimes in DI?
• Transient
• Scoped
• Singleton

8. How is routing handled in .NET Core?


Routing is handled via endpoints or attribute
routing in controllers. Also configurable in
Program.cs or Startup.cs.
9. What is Kestrel?
A cross-platform web server used by .NET
Core to host web applications.

10. What is the difference between


IApplicationBuilder and
IServiceCollection?
• IServiceCollection: Registers services
with DI container.
• IApplicationBuilder: Builds the
middleware pipeline.

11. What is Model Binding in ASP.NET


Core?
It maps HTTP request data (query, form,
route) to action method parameters.

12. What is the difference between


AddControllers() and AddMvc()?
• AddControllers() → Only API controller
support
• AddMvc() → Adds both MVC and Razor
view support

13. How do you enable CORS in .NET


Core?
services.AddCors();
app.UseCors(builder =>
builder.AllowAnyOrigin().AllowAnyMethod().A
llowAnyHeader());
14. What is the purpose of
app.UseRouting() and app.UseEndpoints()?
• UseRouting() enables route matching.
• UseEndpoints() defines what to do once a
route is matched.

15. How do you handle exceptions


globally in .NET Core?
Using app.UseExceptionHandler() or
Middleware.

16. What is Minimal API in .NET 6+?


A way to build lightweight APIs with less
boilerplate code using top-level statements.
17. How do you implement logging in
.NET Core?
Use built-in ILogger<T> or third-party
providers like Serilog, NLog.

18. What is the difference between


IHttpClientFactory and HttpClient?
IHttpClientFactory improves usage by
pooling and managing HttpClient instances
to avoid socket exhaustion.

19. What are Tag Helpers in Razor


Pages?
Server-side components used to generate
HTML elements dynamically in Razor views
(e.g., asp-for, asp-action).
20. How do you secure an API in .NET
Core?
• Use JWT Authentication
• Add Authorize attribute
• Use Identity, OAuth2, or OpenID
Connect for authentication/authorization

You might also like