My controller code looks like this:
[Route("api/[controller]")]
[ApiController]
public class PaymentDetailController : ControllerBase
{
[HttpGet]
public async Task<string> GetPaymentDetail()
{
return "Success";
}
}
I am trying to access like this
http://localhost:47744/api/paymentdetail
http://localhost:47744/api/paymentdetail/GetPaymentDetail
I cant access my controller and method

Your URL points to
/api/paymentdetailbut your ActionMethod is calledGetPaymentDetail().The Url that should be working would most likely be
/api/paymentdetail/getpaymentdetail.You might want to rename your ActionMethod to
Get()since it is already clear what resource you are getting.