我正在尝试使用Grapevine创建一个RESTFUL API。我想创建动态路径,例如
[RestRoute(PathInfo = "api/eshare/getcustomersbyname/{namepart}", HttpMethod = HttpMethod.GET)]目的是搜索所有存在{namepart}的客户,并返回json。
当我在浏览器中输入http://localhost:2000/api/eshare/getcustomersbyname/bio时,我总是得到:Route not Found for GET api/eshare/getcustomersbyname
Thx帮助
发布于 2018-11-20 01:47:20
你真的很接近了。在你的模式中使用方括号而不是花括号。
[RestRoute(PathInfo = "api/eshare/getcustomersbyname/[namepart]", HttpMethod = HttpMethod.GET)]更新:Grapevine 4.x和更低版本用于路由参数的方括号。Asp.net 5+使用大括号(就像Grapevine一样)
https://stackoverflow.com/questions/53221605
复制相似问题