Core Interview Ques
Core Interview Ques
Windows
macOS
Linux
ViewBag: A dynamic object for passing data from the controller to the view.
ViewData: A dictionary for passing data to the view, but requires type casting.
TempData: Stores data temporarily, useful for redirect scenarios.
16. What are the different types of Filters in ASP.NET Core, and how are they
used?
Filters are used to run code before or after an action method executes. Types
include:
17. What is Entity Framework Core, and how does it differ from Entity
Framework 6?
Entity Framework Core is a lightweight, cross-platform version of Entity
Framework. It supports more modern development practices and is designed
for .NET Core, while EF 6 is Windows-only.
18. Describe the Database-First, Code-First, and Model-First approaches in
Entity Framework Core.
19. What are Migrations in Entity Framework Core, and how are they used?
Migrations are a way to update the database schema based on changes in your
model classes. You can add, remove, or modify tables and columns.
20. How do you configure logging in ASP.NET Core?
Logging can be configured in Startup.cs using the built-in logging framework. You
can specify log levels and providers (like console, file, etc.).
21. Explain the concept of Middleware Pipeline in ASP.NET Core.
The Middleware Pipeline is a sequence of middleware components that handle
requests and responses. Each component can process the request, call the next
component, and modify the response.
22. What is the use of appsettings.json file in ASP.NET Core?
appsettings.json is used to store configuration settings for the application, such as
connection strings and application settings.
23. How do you implement Authentication and Authorization in ASP.NET
Core?
Authentication verifies user identity, while authorization checks permissions. You
can use built-in authentication schemes (like JWT, cookies) and configure policies
in Startup.cs.
24. What is JWT authentication, and how is it implemented in ASP.NET
Core?
JWT (JSON Web Token) authentication is a method for securely transmitting
information between parties. In ASP.NET Core, you can configure JWT
authentication in Startup.cs using middleware.
25. Describe the concept of Health Checks in ASP.NET Core.
Health Checks are used to monitor the status of your application and its
dependencies. You can implement health checks to ensure your application is
running smoothly.
26. How do you implement Caching in ASP.NET Core?
Caching can be implemented using in-memory caching or distributed caching. You
can configure caching in Startup.cs and use attributes to cache responses.
27. What is the purpose of the ConfigureServices and Configure methods in
Startup.cs file?
28. Explain the concept of Razor Class Libraries (RCL) in ASP.NET Core.
Razor Class Libraries allow you to create reusable UI components (like views
and pages) that can be shared across multiple applications.
29. How do you handle Errors and Exceptions in ASP.NET Core?
You can handle errors globally using middleware or by using try-catch blocks in
your code. Custom error pages can also be configured.
30. What is the role of IWebHostEnvironment in ASP.NET Core?
IWebHostEnvironment provides information about the web hosting environment,
such as whether the application is in development or production mode.
31. Describe the different types of Testing in .NET Core.
Testing types include:
It looks like my response got cut off! Here’s a continuation of the answers to your
questions about .NET Core:
You can implement background tasks by creating a class that inherits from
BackgroundService and overriding the ExecuteAsync method to define the task.
Worker Services are designed for running background tasks in a hosted service.
They are ideal for applications that need to perform background processing without
a web interface.
45. How do you implement Health Checks for Azure App Services?
You can implement health checks in Azure App Services by configuring the health
check endpoint in the Azure portal and ensuring your application responds
correctly to health check requests.
CI/CD involves automating the process of testing and deploying applications. You
can use tools like Azure DevOps or GitHub Actions to set up pipelines that build,
test, and deploy your .NET Core applications.
Middleware Analysis helps you understand the order and behavior of middleware
components in the pipeline. It’s useful for debugging and optimizing request
processing.
You can handle internationalization and localization by using resource files to store
translations and configuring the application to use the appropriate culture based on
user preferences.
49. What are the different Deployment options for .NET Core applications?
You can troubleshoot performance issues by using profiling tools, analyzing logs,
and monitoring application metrics. Look for bottlenecks in database queries,
memory usage, and response times.