Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core launchSettings.json does not launch browser

I am using dotnet core version 2.1.200.

For my asp.net core application I have following launchSettings.json file:

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iis": {
      "applicationUrl": "http://localhost/Contoso.Web.Manager",
      "sslPort": 0
    },
    "iisExpress": {
      "applicationUrl": "http://localhost:64802/",
      "sslPort": 44337
    }
  },
  "profiles": {
    "dev": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost.manager.contoso.com:5000/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

when I run dotnet run --launch-profile dev this runs application fine in console, but does not open new browser window.

Am I missing something here?

Docs (Use multiple environments in ASP.NET Core): https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1

like image 608
Teoman shipahi Avatar asked Aug 11 '26 00:08

Teoman shipahi


2 Answers

You need applicationUrl and launchUrl, eg:

    "dev": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "/swagger/",
      "applicationUrl": "http://localhost.manager.contoso.com:5000/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
like image 145
filype Avatar answered Aug 13 '26 09:08

filype


Seems like you should use "applicationUrl" instead of "launchUrl" in your dev profile.

"applicationUrl": "http://localhost.manager.contoso.com:5000/",
like image 44
Botsman Avatar answered Aug 13 '26 08:08

Botsman