Configuration & Logging Flashcards
6 cards from real ASP.NET Core practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Configuration & Logging flashcards as text
Which file is the primary configuration source in an ASP.NET Core application?
Answer: appsettings.json
appsettings.json is the default configuration file read by the ASP.NET Core host, with environment-specific overrides supported.
What is the correct order for configuration providers in the default ASP.NET Core host?
Answer: appsettings.json → appsettings.{env}.json → environment variables → command-line
Later providers override earlier ones, so environment variables and command-line arguments override JSON file values by default.
How do you access a nested configuration value 'Database:ConnectionString' in ASP.NET Core?
Answer: configuration["Database:ConnectionString"]
Hierarchical configuration keys use colon (:) as the separator when accessed via the IConfiguration indexer.
What is the purpose of the IOptions interface in ASP.NET Core?
Answer: To inject strongly typed configuration settings bound to a class
IOptions provides a bound, typed settings object injected into services, configured via services.Configure().
Which method binds a configuration section to a C# class in ASP.NET Core?
Answer: services.Configure(configuration.GetSection("Section"))
services.Configure() with GetSection() registers the options class and binds configuration values to its properties.
Which configuration provider lets you store sensitive data outside the project during development?
Answer: Secret Manager (User Secrets)
The Secret Manager tool stores secrets in a per-user profile folder outside the project tree, preventing accidental commits.