I have an Asp.NET Core project that is intended to be a multi-tenant application, but I'm having trouble configuring the project to use the host names I define in a hosting.json file. It works fine if I use UseUrls(), but I eventually need these settings for localhost to be able to be overwritten by environment variables. This is what's going on in my main thread:
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("hosting.json", optional: true)
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>()
//.UseApplicationInsights()
.Build();
host.Run();
And my hosting.json file:
{
"server.urls": "http://localhost:5000;http://localhost:5001"
}
If I start the project, it only listens on the App Url defined in the debug section of project properties. I'm not sure what's going wrong.
I used this tutorial to get to this point.