【发布时间】:2015-09-07 09:52:01
【问题描述】:
在使用 Web API 时,遇到了从客户端调用 GET 方法的情况。
//This didn't worked
public IEnumerable<type> Get(string mode)
{
//Code
}
//This worked
public IEnumerable<type> Get(string id)
{
//Code
}
只需更改参数名称即可使我的调用成功。我正在使用默认路由。
这种方法有什么问题。如果我想要一个带有多个参数的 GET 方法怎么办。例如:
pulbic string GET(string department, string location)
{
//Code here
}
【问题讨论】:
标签: asp.net-web-api2 asp.net-web-api-routing