In .NET Core, configuration settings can come from different sources:
- File formats (INI, JSON, and XML).
- Command-line arguments.
- Environment variables.
- In-memory .NET objects.
- The unencrypted Secret Manager storage.
- An encrypted user store, such as Azure Key Vault.
- Custom providers (installed or created).
As you see you have numerous options and you can even use multiple of them simultaneously. Choose whatever source you like or the one(s) fitting your scenario the best.
In ASP.NET Core applications JSON files are used usually. (However, settings from command line and environment variables is picked up by default, as well). The naming convention of the JSON config file is appsettings.json (but you can use another name if you want). So we can say, appsettings.json is roughly the equivalent for App.config in .NET Core.
The code sample below shows how you can read settings from a JSON file:
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json");
var configuration = builder.Build();
(To compile this, you'll need to have the Microsoft.Extensions.Configuration.Json NuGet package installed.)
Thereafter you can access the configuration data by the dictionary-like interface of the configuration object.
However, there are more convenient ways to consume the configuration data. The recommended method, which is used in ASP.NET Core extensively, is the Options API.
You find all the details in the MSDN docs.