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

ome*_*ega 2 asp.net api debugging visual-studio

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

http://localhost:53961/api/...
Run Code Online (Sandbox Code Playgroud)

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

No HTTP resource was found that matches the request URI
Run Code Online (Sandbox Code Playgroud)

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

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

    }
Run Code Online (Sandbox Code Playgroud)

我看到一条消息:

The breakpoint will currently not be hit. No code has been loaded for this code location.
Run Code Online (Sandbox Code Playgroud)

Moh*_*ood 6

You can set "Multiple startup projects". Right click on solution in solution explorer and then click properties. Common Properties->Startup Project and then select "Multiple startup projects" and then set the Action for both of your APIs to "Start"

在此处输入图片说明