Vscode debug asp net core app launch browser on specific port


When an ASP.NET Core application using Visual Studio Code, you may want to debug your application and launch the on a port. This can be useful when you have applications running on different ports and want to easily differentiate between them. In this article, we will explore how to achieve this using Visual Studio Code.

the launch.json file

The step is to configure the launch.json file in your ASP.NET Core project. This file is used to define the debug configurations for your application. Open the launch.json file by clicking on the Debug icon in the Activity Bar on the side of Visual Studio Code and selecting “Open Configurations”.

Inside the launch.json file, you will find a configurations array. Add a new configuration object to this array with the following :

  "name": "Launch on Specific Port",
  "type": "coreclr",
  "request": "launch",
  "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/{your-application-name}.dll",
  "args": [],
  "cwd": "${workspaceFolder}",
  "stopAtEntry": false,
  "console": "internalConsole",
  "env": {
    "ASPNETCORE_URLS": "http://localhost:{your-port-number}"
  "sourceFileMap": {
    "/Views": "${workspaceFolder}/Views"

Make sure to replace “{your-application-name}” with the name of your application and “{your-port-number}” with the desired port number.

Launching the Application

Once you have configured the launch.json file, you can launch your ASP.NET Core application with the specified port. To do this, click on the Debug icon in the Activity Bar and select “Launch on Specific Port” from the dropdown menu.

Visual Studio Code will start the process and launch the browser on the specified port. You can now test your application and debug any issues that arise.


Configuring Visual Studio Code to launch the browser on a specific port when debugging an ASP.NET Core application can greatly your development . By following the steps outlined in this article, you can easily differentiate between multiple applications running on different ports and efficiently debug your code.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents