Removing Kestrel binding warning

First of all, that “noise” is not really that noise if you consider that you only get this once when the application starts. So unless you are doing something weird where you need to restart your app, then you will probably almost never see that line in your logs, compared to all those other (much noisier) messages.

That being said, it is actually a useful warning because it tells you that you have configured the binding URL in multiple locations. So the proper action is not to ignore that message but to actually remove the duplicate configurations.

In this case, you are using explicit listen options with UseKestrel() so that trumps everything. So you should remove the other configurations. There are a few locations where you should look:

  • ASPNETCORE_URLS environment variable.
  • Legacy ASPNETCORE_SERVER.URLS environment variable.
  • Properties/launchSettings.json.

Had the same slightly annoying warning and checked the environment variables and configuration files, but was unable to locate the source of the url list. In the end I used IWebHostBuilder.UseUrls() with an empty list of urls to get rid of the warning.

 IWebHostBuilder builder = new WebHostBuilder()
   .UseUrls()
   .UseKestrel()
   .ConfigureKestrel(...

Edit: For .net6

var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls();

This is an old question but you can resolve that conflict between launchSettings.json and appSettings.json with "externalUrlConfiguration": true

Kestrel configuration in appSettings.json:

"Kestrel": {
"EndpointDefaults": {
  "Protocols": "Http1AndHttp2"
},
"Endpoints": {
  "HTTPS": {
    "Url": "https://localhost:4433"
  }
}

And this is launchSettings.json content:

{
  "profiles": {
    "TestApplication": {
      "commandName": "Project",
      "launchBrowser": true,
      "externalUrlConfiguration": true, //add this line
      "applicationUrl": "https://localhost:5001",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}