As mentioned in a comment on the accepted answer, 2.1 has support for appsettings.json, see https://blogs.msdn.microsoft.com/webdev/2018/02/02/asp-net-core-2-1-roadmap/#security
A working appsettings.json:
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://localhost:5555"
}
}
}
This is for a Program.cs using (created by “dotnet new webapi”):
WebHost.CreateDefaultBuilder(args)
Relevant source code in GitHub
https://github.com/aspnet/MetaPackages/blob/master/src/Microsoft.AspNetCore/WebHost.cs#L163
options.Configure(builderContext.Configuration.GetSection("Kestrel"));
and https://github.com/aspnet/MetaPackages/blob/master/src/Microsoft.AspNetCore/WebHost.cs#L169
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)