.NET Core: UseUrls seems getting ignored error
If you are facing the issue, that the Host.CreateDefaultBuilder’s ConfigureWebHostDefaults’s UseUrls method is getting ignored, and all the environment variables and launchsettings.json completly getting ignored by the .NET core application, its always using the default port of http : 5000 and the https 5001, follow the instructions
Are you using configuration builder before calling the configurewebhostdefaults?
ConfigurationBuilder cfgBuilder = new ConfigurationBuilder();
cfgBuilder.AddEnvironmentVariables("CONFIGPREFIX_");
IConfigurationRoot configuration = cfgBuilder.Build();
And are you passing the built configuration to ConfigureAppConfiguration ? Like that:
.ConfigureAppConfiguration(builder =>
{
builder.Sources.Clear();
builder.AddConfiguration(configuration);
})
Then remove the ConfigureAppConfiguration call, and it will work..
No idea how to work around
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Hi, I am András,
I am a seasoned software engineer from Budapest, Hungary with a strong focus on mobile app development using .NET MAUI and Xamarin.Forms. My expertise also extends to website building for my happy customers and other complex system designing. I am passionate about developing well-organized, maintainable software solutions.