【发布时间】:2021-09-04 14:47:18
【问题描述】:
我的控制器代码如下所示:
[Route("api/[controller]")]
[ApiController]
public class PaymentDetailController : ControllerBase
{
[HttpGet]
public async Task<string> GetPaymentDetail()
{
return "Success";
}
}
我正在尝试这样访问
http://localhost:47744/api/paymentdetail
http://localhost:47744/api/paymentdetail/GetPaymentDetail
我无法访问我的控制器和方法
【问题讨论】:
-
paymentdetail是 controller 的名称 -GetPaymentDetail是操作方法 - 根据需要组合成完整的 URL/api/paymentdetail/GetPaymentDetail- 所以是什么问题或疑问,真的???
标签: c# asp.net-core .net-core routes attributerouting