← All ASP.NET Core Flashcard Decks

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
  1. What is the default hierarchy of configuration providers in ASP.NET Core?

    Answer: appsettings.json → appsettings.{Env}.json → Environment variables → Command-line (last wins)

    Later providers override earlier ones: appsettings.json → environment-specific file → env vars → command-line args.

  2. Which environment variable sets the current environment in ASP.NET Core?

    Answer: ASPNETCORE_ENVIRONMENT

    ASPNETCORE_ENVIRONMENT sets the hosting environment name, which determines which appsettings.{Env}.json file is loaded.

  3. How do you bind a configuration section to a strongly-typed class?

    Answer: Configuration.GetSection("Key").Bind(instance)

    GetSection("Key").Bind(instance) or GetSection("Key").Get() maps configuration values to properties of a strongly-typed class.

  4. What does IOptions provide compared to IOptionsSnapshot?

    Answer: IOptions is singleton and does not reload; IOptionsSnapshot reloads per-request

    IOptions is a singleton that doesn't reload; IOptionsSnapshot is scoped and reflects configuration changes per request.

  5. Which interface provides configuration that reloads when the source file changes?

    Answer: IOptionsMonitor

    IOptionsMonitor is a singleton that fires a change notification and provides the latest configuration when the source changes.

  6. How do you add a custom configuration source in ASP.NET Core?

    Answer: Implement IConfigurationSource and IConfigurationProvider, then call builder.Configuration.Add()

    You implement IConfigurationSource to describe the source and IConfigurationProvider to load data, then add it via builder.Configuration.Add().

Configuration & Environments Flashcards — ASP.NET Core Study Cards with Answers