【问题标题】:How to debug with 2 web API projects in visual studio solution? [duplicate]如何在 Visual Studio 解决方案中使用 2 个 Web API 项目进行调试? [复制]
【发布时间】:2018-11-14 04:54:09
【问题描述】:

我有一个包含 2 个项目的 Visual Studio 解决方案。两者都是 Web API(不是 .net 核心)。当我有一个项目时,我可以通过点击

来调试它
http://localhost:53961/api/...

然后我添加了第二个项目。如何开始调试第二个?它似乎没有达到断点。我明白了

No HTTP resource was found that matches the request URI

当我在 main 方法上设置断点时

    // GET: api/<controller>
    [HttpGet]
    public async Task<Result> Get(string emails)
    {

    }

我看到一条消息:

The breakpoint will currently not be hit. No code has been loaded for this code location.

【问题讨论】:

  • 您是否将第二个 api 端口设置为与第一个 api 不同的端口?
  • 我怎样才能知道两者的设置位置?
  • 项目属性 --> 调试 --> 应用 url
  • 如果您希望 api 在同一个 url 上运行,您需要确保将程序集从一个 api 加载到另一个。在.net core中你只需要将项目引用到启动项目..不知道在net45中是否相同>

标签: asp.net visual-studio api debugging


【解决方案1】:

您可以设置“多个启动项目”。在解决方案资源管理器中右键单击解决方案,然后单击属性。 Common Properties->Startup Project,然后选择“Multiple startup projects”,然后将两个 API 的 Action 设置为“Start”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多