From launch.json, what is the correct way to launch an ASP.NET Core on a specific port? For instance, when I run my .NET Core app, VS Code, hosts it on localhost:5000, but I instead want to host it on localhost:5050.
Thanks in advance.
To change the port the application is using, Open the file lunchSetting. json. You will find it under the properties folder in your project and as shown below. Inside the file, change applicationUrl port (below is set to 5000) to a different port number and save the file.
You can run an ASP.NET Core application from Visual Studio Code directly. To accomplish this, open the Command Palette, type dnx and press Enter. Next, select dnx: Run Command and press Enter.
Yes, we can change live server port in vs code as per out choice. This can be very easily done by the following ways, Open up live server extension > Go to it's Extension Settings > Open up settings. json > Change the port.
In Solution Explorer, right-click the name of the web application and select Properties. Click the Web tab. In the Servers section, under dropdown selection for IIS Express, change the port number in the Project URL box. To the right of the Project URL box, click Create Virtual Directory, and then click OK.
You can config it via environment variable ASPNETCORE_URLS
macOS:
export ASPNETCORE_URLS=http://localhost:5050
windows:
set ASPNETCORE_URLS=http://localhost:5050
or add this to launch.json
"env": { "ASPNETCORE_URLS": "http://localhost:5050" }
If you don't want to specify the hostname, you can use * instead
http://*:5050
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With