ASP.Net Core Web API custom route not working
问题 I have a ASP.Net Core Web API project, and the following controller: [Route("/api/v0.1/controller")] [ApiController] public class MyController : ControllerBase { [HttpGet("/test")] public ActionResult Test() { return null; } } but when I run the project, at /api/v0.1/controller/test I get "page not found" and I don't see where I made a mistake. 回答1: Your method route template contains prefixed / , due to that, the app route couldn't find the appropriate path. Modify test method route template