Search code examples
asp.netvisual-studio-code

Where to specify localhost port in VS Code


I am building an ASP.NET Core app and am wanting to use a specific port when launching debug in VS Code. It defaults to running http:// localhost:5000. I am unable to find any setting for where I would change this. When I try to specify a port setting in the launch.json file, I am being alerted that it is not allowed. Is there a specific setting to set for specifying which port?


Solution

  • In your Program.cs

    try to add .UseUrls("http://localhost:5050")

    Port number can be anything other than the specified one