Метод контроллера API не вызывается, но возвращается http 200 okC#

Место общения программистов C#
Anonymous
Метод контроллера API не вызывается, но возвращается http 200 ok

Сообщение Anonymous »

Я добавил контроллер в существующее приложение, в котором вызываю метод

Код: Выделить всё

/// 
///
/// 
[Authorize]
[ApiController]
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/bank-data")]
public class BankDataController : ControllerBase
{
#region FIELDS

private readonly IService _service;

#endregion

#region CONSTRUCTORS

/// 
///
/// 
/// 

public BankDataController(IService service)
{
_service = service ?? throw new ArgumentNullException(nameof(service));
}

#endregion

#region METHODS
/// 
/// Get Bank Detail
/// 
/// 
[HttpGet]
[Route("{code}/data/{progressive}")]
[OpenApiOperation("getBankData")]
[ProducesResponseType(type: typeof(BankDataDetailDto), statusCode: StatusCodes.Status200OK)]
[ProducesResponseType(type: typeof(ForbiddenResponse), statusCode: StatusCodes.Status403Forbidden)]
[ProducesResponseType(type: typeof(BadRequestResponse), statusCode: StatusCodes.Status400BadRequest)]
[ProducesResponseType(type: typeof(UnAuthorizedResponse), statusCode: StatusCodes.Status401Unauthorized)]
[ProducesResponseType(type: typeof(InternalServerErrorResponse), statusCode: StatusCodes.Status500InternalServerError)]
public async Task GetBankData(Guid code, int progressive)
{
var result = await _service.GetBankDataDetail(code, progressive);
return Ok(result);
}

#endregion
}
Я пробую этот метод с помощью Swagger, но точка останова, которую я поставил для проверки метода, никогда не срабатывает.
Это URL-адрес, напечатанный Swagger -> http://localhost:44747/api/v1/bank-data ... 90/data/11
Но ответ:

Код: Выделить всё

date: Tue,02 Jul 2024 15:03:42 GMT
server: Microsoft-IIS/10.0
transfer-encoding: chunked
x-powered-by: ASP.NET
У меня нет исключений, потому что мне возвращается http-код 200 ок, но я не могу понять, в чем дело

Подробнее здесь: https://stackoverflow.com/questions/786 ... s-returned

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