ho provato anche così:
codice:
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "MySettings": {
    "DbConnection": "abc",
    "Email": "abc@domain.com",
    "SMTPPort": "5605"
  }
}
e poi:
codice:
namespace CSharpNetCoreWeb.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        private IConfiguration configuration { get; }

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
            string dbConn = configuration.GetSection("MySettings").GetSection("DbConnection").Value;
            Debug.WriteLine("STRINGA: " + dbConn);
        }
.........................
    }
}
ma mi va in errore:
codice:
System.NullReferenceException: 'Object reference not set to an instance of an object.'

CSharpNetCoreWeb.Controllers.HomeController.configuration.get ha restituito null.
sinceramente non capisco, ho letto tonnellate di esempi in giro, e anche la documentazione!