Configuration & Environments 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 & Environments flashcards as text
What is the purpose of User Secrets in ASP.NET Core development?
Answer: Storing sensitive development config outside the project directory
User Secrets store sensitive configuration (API keys, connection strings) outside the project folder during development to avoid committing them to source control.
Which CLI command initializes User Secrets for an ASP.NET Core project?
Answer: dotnet user-secrets init
dotnet user-secrets init adds a UserSecretsId GUID to the project file and sets up the local secrets store.
How do environment-specific appsettings files override the base file?
Answer: Environment file values override matching keys in appsettings.json; unmatched keys remain from base
appsettings.{Environment}.json merges with appsettings.json; matching keys are overridden while unspecified keys remain from the base file.
What format does ASP.NET Core use for nested configuration keys in environment variables?
Answer: Colon notation: Section:Key or double underscore: Section__Key
Environment variables use double underscores (__) as hierarchy separators because colons are not valid in all environments, mapping to Section:Key in configuration.
What is the IHostEnvironment interface used for?
Answer: Accessing environment name, content root, and web root paths
IHostEnvironment provides the environment name (Development/Production), ContentRootPath, and other environment metadata.
Which method checks if the current environment is Development?
Answer: env.IsDevelopment()
IHostEnvironment.IsDevelopment() is an extension method that returns true when the environment name equals "Development".