You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ASP.NET Core 8 Web API接口断点无法命中问题求助

ASP.NET Core 8 Web API接口断点无法命中问题

我创建了一个ASP.NET Core 8 Web API项目,已更新program.cs中的目标代码,但接口内的断点无法命中,仅能调试program.cs入口处的代码。

接口代码

proposalApi.MapGet("/proposals", () => {
    try
    {
        DirectoryInfo dir = new DirectoryInfo(ProposalsDirectory);
        var files = dir.GetFiles("*.txt").Select(x => x.Name).ToList();
        var data = files.Select(x => new
        {
            index = int.Parse(new String(x.Where(Char.IsDigit).ToArray())),
            value = x
        }).OrderByDescending(x => x.index).Select(x => x.value).ToArray();

        return data.Count() == 0 ? Results.NotFound() : Results.Ok(data);
    }
    catch (Exception ex)
    {
        return ErrorDetails(ex);
    }
});

proposalApi.MapGet("/proposals/{fileName}", (int fileName) => {
    try
    {
        string content = File.ReadAllText(ProposalsDirectory + fileName);
        return Results.Ok(content);
    }
    catch (Exception ex)
    {
        return ErrorDetails(ex);
    }
});

尝试访问的URL

  • https://localhost:44312/proposals/proposals
  • https://localhost:44312/proposals/

断点情况

断点截图

项目代码路径

github.com/nitinjs/upworkify/tree/main/ProposalAPI.Core


内容的提问来源于stack exchange,提问作者Nitin S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 14:59:57