.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 Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.