首页 > 解决方案 > 如何在 Visual Studio 解决方案中使用 2 个 Web API 项目进行调试?

问题描述

我有一个包含 2 个项目的视觉工作室解决方案。两者都是 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.

标签: asp.netvisual-studioapidebugging

解决方案


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

在此处输入图像描述


推荐阅读