【发布时间】:2019-01-23 00:22:43
【问题描述】:
我正在尝试制作一个采用 3 个参数的 HTTP Get REST API。 但是,我收到错误或 3 个参数未通过。
我收到构建错误 - "HttpGetAttribute does not contain a constructor that takes 3 arguments"
这里是方法,我正在检查它。
https://localhost:44312/api/test/1/2/3
我已经删除了 HttpGet 行,但它没有帮助。
[Route("api/controller/{a}/{b}/{c}")]
[HttpGet("{a}", "{b}", "{c}")]
public string Get(int a, int b, int c){
int sum = a + b + c;
return sum.ToString();
}
我希望 URL 将这些参数传递给 REST GET API。
【问题讨论】:
-
试过了,但是不行
-
你在这里使用的网址 - 是我自己的网址
-
[HttpGet("{a}/{b}/{c}")]
标签: c# asp.net-core