【问题标题】:Start ASP.NET Core API locally on specific URL like localhost:port/root/在特定 URL 上本地启动 ASP.NET Core API,例如 localhost:port/root/
【发布时间】:2022-11-16 00:18:05
【问题描述】:

我有 2 个普通的 ASP.NET Core API。

当我在 Visual Studio 中以调试模式运行 API 时,它从 https://localhost:1234/ 开始(这里的 1234 是随机端口)。

我想使用 URL https://localhost:1234/first/ 和 https://localhost:1234/second 在本地运行这两个 API。我需要这些 API 可用于在 VS 中进行调试。

实现这一目标的最简单方法是什么?有没有办法通过修改 launchSettings.json 来实现?

【问题讨论】:

    标签: asp.net .net debugging devops


    【解决方案1】:

    您不能使用同一端口运行 2 个不同的应用程序。 您需要修改一个应用程序 (launchsettings.json) 以在不同的端口上运行。 如果您希望 /first 和 /second 可用,则必须在同一个项目中创建两者(端点、控制器等)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-28
      • 2017-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-23
      • 1970-01-01
      • 2015-07-12
      相关资源
      最近更新 更多