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
相关产品推荐
相关产品推荐

