.NET

Configuration & Settings

appsettings.json, user secrets, environment variables, options pattern, best practices

20 preguntas de entrevista·
Junior
1

What is the default priority order of configuration sources in ASP.NET Core?

Respuesta

Configuration sources are read in a specific order where later sources override earlier ones. Environment variables have the highest priority, followed by appsettings.{Environment}.json, then appsettings.json. User Secrets is only loaded in Development environment and has lower priority than environment variables.

2

What is the main benefit of using separate appsettings.{Environment}.json files?

Respuesta

appsettings.{Environment}.json files allow defining environment-specific configurations without changing code. For example, a local connection string in Development and an Azure connection string in Production. This avoids hardcoding values or modifying code during deployment.

3

What is the main role of User Secrets in ASP.NET Core?

Respuesta

User Secrets stores secrets (API keys, connection strings) in a local JSON file located outside the project, typically in the user directory. This prevents accidentally committing secrets to Git. User Secrets is only loaded in Development environment and should never be used in production.

4

What is the key difference between IOptions<T> and IOptionsSnapshot<T>?

5

When should you use IOptionsMonitor<T> instead of IOptionsSnapshot<T>?

+17 preguntas de entrevista

Domina .NET para tu próxima entrevista

Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.

Empieza gratis