I added a controller to an existing application in which I call a method
<code>/// <summary>
///
/// </summary>
[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
/// <summary>
///
/// </summary>
/// <param name="service"></param>
public BankDataController(IService service)
{
_service = service ?? throw new ArgumentNullException(nameof(service));
}
#endregion
#region METHODS
/// <summary>
/// Get Bank Detail
/// </summary>
/// <returns></returns>
[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<IActionResult> GetBankData(Guid code, int progressive)
{
var result = await _service.GetBankDataDetail(code, progressive);
return Ok(result);
}
#endregion
}
</code>
<code>/// <summary>
///
/// </summary>
[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
/// <summary>
///
/// </summary>
/// <param name="service"></param>
public BankDataController(IService service)
{
_service = service ?? throw new ArgumentNullException(nameof(service));
}
#endregion
#region METHODS
/// <summary>
/// Get Bank Detail
/// </summary>
/// <returns></returns>
[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<IActionResult> GetBankData(Guid code, int progressive)
{
var result = await _service.GetBankDataDetail(code, progressive);
return Ok(result);
}
#endregion
}
</code>
/// <summary>
///
/// </summary>
[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
/// <summary>
///
/// </summary>
/// <param name="service"></param>
public BankDataController(IService service)
{
_service = service ?? throw new ArgumentNullException(nameof(service));
}
#endregion
#region METHODS
/// <summary>
/// Get Bank Detail
/// </summary>
/// <returns></returns>
[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<IActionResult> GetBankData(Guid code, int progressive)
{
var result = await _service.GetBankDataDetail(code, progressive);
return Ok(result);
}
#endregion
}
I try this method with swagger, but breakpoint that I put to test the method is never triggered
This is the url print by swagger -> http://localhost:44747/api/v1/bank-data/826acae7-6a79-4337-88dd-04377a6db090/data/11
But the response are:
<code>date: Tue,02 Jul 2024 15:03:42 GMT
server: Microsoft-IIS/10.0
transfer-encoding: chunked
x-powered-by: ASP.NET
</code>
<code>date: Tue,02 Jul 2024 15:03:42 GMT
server: Microsoft-IIS/10.0
transfer-encoding: chunked
x-powered-by: ASP.NET
</code>
date: Tue,02 Jul 2024 15:03:42 GMT
server: Microsoft-IIS/10.0
transfer-encoding: chunked
x-powered-by: ASP.NET
I don’t have any exceptions, because the http code 200 ok is returned to me, but I can’t understand what’s wrong