2

I am trying to follow this tutorial: https://code.visualstudio.com/docs/containers/quickstart-aspnet-core

In the section "Debug in container" I am having issues with debugging this application. When I run the debugger, the chrome browser opens up to http://localhost:7009 and displays the following error:

This localhost page can’t be foundNo webpage was found for the web address: http://localhost:7009/
HTTP ERROR 404

The problem is that the launchurl that is specified within the launchSetting.json file does not seem to be working. Here is the launchSettings.json file:

"profiles": {
    "TodoApi": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "launchUrl": "WeatherForecast",
      "applicationUrl": "https://localhost:7009;http://localhost:5189",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "WeatherForecast",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }

I have specified the launchUrl to "WeatherForecast" so that when the browser launches it should go to https://localhost:7009/WeatherForecast but that's not happening.

I tried setting applicationUrl to "https://localhost:7009/WeatherForecast" but that generates an error during build.

I am running Visual Studio Code for Mac if that makes any difference.

Thanks for any help!

2
  • Having the same issue today on Windows 10 using visual studio code. Commented Aug 15, 2022 at 14:19
  • Make 100% sure you're editing the correct launchsettings file. I'm using Blazor and just discovered I was editing the Client instead of the server file. Commented Jun 24, 2023 at 20:39

2 Answers 2

2

If you are using the OmniSharp plugin you can fix this the following way.

In ./.vscode/launch.json modify serverReadyAction and add uriFormat to be the URL that you want.

        "serverReadyAction": {
            "action": "openExternally",
            "pattern": "\\bNow listening on:\\s+http://\\S+:([0-9]+)",
            "uriFormat": "http://localhost:%s/WeatherForecast"
        },
Sign up to request clarification or add additional context in comments.

1 Comment

0

In my case it tooks only the URL(https://localhost:7009) in .net 6.0. so https://localhost:7009/swagger/index.html. It works

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.