I can set the port for my asp.net core 3 project from a appsettings.json files using the following code.
public static IWebHostBuilder CreateWebHostBuilder(st