在VS Code中指定localhost端口的位置 [英] Where to specify localhost port in VS Code

查看:236
本文介绍了在VS Code中指定localhost端口的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个 ASP.NET 核心应用程序,并希望在 VS Code 中启动调试时使用特定的端口.它默认运行 http://localhost:5000 .我找不到要更改此设置的任何设置.当我尝试在 launch.json 文件中指定 port 设置时,系统提示我不允许这样做.是否有用于指定哪个 port 的特定设置?

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?

推荐答案

在您的 Program.cs

尝试添加 .UseUrls("http://localhost:5050")

端口号可以不是指定的端口号

Port number can be anything other than the specified one

这篇关于在VS Code中指定localhost端口的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆