Веб-API ASP.NET Core 8: точка останова не достигается ⇐ C#

Место общения программистов C#
Anonymous
Веб-API ASP.NET Core 8: точка останова не достигается

Сообщение Anonymous »

Я создал проект веб-API ASP.NET Core 8. Я обновил файл 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/
Точки останова:
[img]https://i. sstatic.net/cw0epwFg.png[/img]

Путь к коду проекта веб-API (скрипт):
https://github.com/nitinjs /upworkify/tree/main/ProposalAPI.Core

Подробнее здесь: https://stackoverflow.com/questions/791 ... -being-hit

Вернуться в «C#»