ASP.net web api 2 Route-Attribute not working

前端 未结 7 1875
野性不改
野性不改 2021-01-19 17:52

I\'ve the following problem, my route attribute is not working.

I have the following action:

[HttpGet]
[Route(\"~api/admin/template/{fileName}\")]
pu         


        
7条回答
  •  礼貌的吻别
    2021-01-19 18:26

    In my case, I added Route("api/dashboard") to api controller. Changed it to RoutePrefix("api/dashboard") . And it works perfectly. Also you need config.MapHttpAttributeRoutes(); in webapiconfig.cs

提交回复
热议问题