ASP.NET Core Interview

Application Structure & Configuration

ASP.NET Core interview questions covering application structure & configuration.

25 Questions Filter by level

Interview questions

Open a question for the full answer, code and interview guidance.

25 Results
26
JuniorBeginner

What is configuration in ASP.NET Core?

Configuration in ASP.NET Core is the system used to read application settings from multiple sources and expose them through a unified key-value interface.

27
JuniorBeginner

What is appsettings.json in ASP.NET Core?

appsettings.json is a standard JSON configuration file used by ASP.NET Core applications. It usually stores non-secret application settings such as logging configuration, connection string names, feature settings, and service options.

28
JuniorBeginner

How do environment-specific appsettings files work?

ASP.NET Core can load configuration files for the current hosting environment. A typical application has appsettings.json plus files such as appsettings.Development.json, appsettings.Staging.json, and appsettings.Production.json.

29
JuniorBeginner

What is IConfiguration and how is it used?

IConfiguration represents the application's configuration data. It provides access to configuration values regardless of which provider supplied them.

30
JuniorBeginner

What is the Options pattern in ASP.NET Core?

The Options pattern binds a related group of configuration settings to a strongly typed class. It avoids repeatedly using string configuration keys and makes settings easier to validate, test, and inject.

31
JuniorBeginner

What is the difference between IOptions, IOptionsSnapshot, and IOptionsMonitor?

IOptions<T> provides a singleton-style options value and is suitable when settings do not need to change while the application is running.

32
JuniorBeginner

How do you validate strongly typed configuration options?

ASP.NET Core can validate options when they are configured. Validation prevents the application from running with missing or invalid settings.

33
JuniorBeginner

How should secrets be managed in ASP.NET Core?

Secrets such as passwords, API keys, client secrets, and signing keys should not be hard-coded in source code or committed to appsettings.json in a public repository.

34
JuniorBeginner

What are ASP.NET Core environments?

Environments allow an ASP.NET Core application to change behavior according to where it is running. The standard environment names are Development, Staging, and Production, although custom names can also be used.

35
JuniorBeginner

What is IWebHostEnvironment?

IWebHostEnvironment provides information about the web hosting environment. Important properties include EnvironmentName, ApplicationName, ContentRootPath, and WebRootPath.

36
JuniorBeginner

What is Program.cs in modern ASP.NET Core?

Program.cs is the main application entry point in modern ASP.NET Core. With the minimal hosting model introduced in .NET 6, it commonly contains service registration, application construction, middleware configuration, route mapping, and the call to Run().

37
JuniorBeginner

What happened to Startup.cs in modern ASP.NET Core?

Older ASP.NET Core templates commonly used Startup.cs with ConfigureServices() and Configure() methods. Modern templates use the minimal hosting model and place equivalent configuration in Program.cs.

38
JuniorBeginner

What is WebApplicationBuilder?

WebApplicationBuilder is the object created by WebApplication.CreateBuilder(args). It is used to configure services and application infrastructure before the application is built.

39
JuniorBeginner

What is WebApplication?

WebApplication represents the configured ASP.NET Core application and combines hosting, middleware pipeline configuration, endpoint routing, and application lifetime functionality.

40
JuniorBeginner

What is the wwwroot folder in ASP.NET Core?

wwwroot is the conventional web root directory for publicly served static files. It commonly contains CSS, JavaScript, images, fonts, and client-side libraries.

41
JuniorBeginner

What is launchSettings.json?

launchSettings.json contains local launch profiles used by development tools such as Visual Studio and dotnet run. It can define application URLs, environment variables, launch behavior, and profiles for IIS Express or the project.

42
JuniorBeginner

What is the difference between ContentRootPath and WebRootPath?

ContentRootPath is the base path for application content such as configuration files, Razor files, and other project content. It is normally the directory containing the application.

43
JuniorBeginner

How are connection strings stored and read in ASP.NET Core?

Connection strings are commonly placed in the ConnectionStrings section of configuration. They can then be retrieved using IConfiguration.GetConnectionString(name).

44
JuniorBeginner

What are configuration providers in ASP.NET Core?

Configuration providers are components that supply configuration key-value pairs to the ASP.NET Core configuration system.

45
JuniorBeginner

How do environment variables map to nested configuration keys?

ASP.NET Core's environment variable configuration provider supports hierarchical configuration. Because a colon is not portable in environment variable names on every platform, a double underscore is commonly used to represent a colon.

46
JuniorBeginner

How can command-line arguments configure an ASP.NET Core application?

Command-line arguments are added to configuration by the default host configuration created with WebApplication.CreateBuilder(args).

47
JuniorBeginner

How can custom configuration be added in Program.cs?

Custom configuration sources can be added through builder.Configuration before the application is built. Examples include an additional JSON file, an in-memory dictionary, environment variables with a prefix, or a custom configuration provider.

48
JuniorBeginner

How should application startup code be organized as a project grows?

As an ASP.NET Core application grows, Program.cs can become difficult to maintain if every service registration and middleware rule is written inline.

49
JuniorBeginner

What is the difference between configuration and dependency injection?

Configuration and dependency injection solve different problems.

50
JuniorBeginner

What are good practices for ASP.NET Core application structure and configuration?

A maintainable ASP.NET Core application should keep responsibilities separated and make environment-specific behavior explicit.