Currently I am running dotnet core mvc 3.1 on a Ubuntu server. When I run the application I see this:
./MyApp.Web ASPNETCORE_ENVIRONMENT=Production ASPNETCORE_URLS=http://1.2.3.4/
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /root/apps
^Cinfo: Microsoft.Hosting.Lifetime[0]
I have a appsettings.Product.json file also that has:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Redis": {
"Host": "localhost",
"Port": "6379"
},
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "http://1.2.3.4"
}
}
}
}
My Program.cs has:
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
I am confused why the appsettings.Production.json file is not being used, and also why the environment variables I am passing are also not being used.
Any help?