ASP.net web api 2 Route-Attribute not working

前端 未结 7 1956
野性不改
野性不改 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条回答
  •  萌比男神i
    2021-01-19 18:46

    try adding a forward slash after the tilde
    [HttpGet]
    [Route("~/api/admin/template/{fileName}")]
    public HttpResponseMessage Template(string fileName)
    {
        return CreateHtmlResponse(fileName);
    }
    

提交回复
热议问题