ApiController操作无法从查询字符串解析数组

使用Visual Studio 2012.2,MVC4 Web应用程序。

我有这样的请求来到我的ApiController:

http://localhost/api/keys?ids[]=1&ids[]=2&ids[]=3 

我的印象是以下方法应该能够自动从ids []数组中检索值:

 public KeysModel Get(int[] ids){...} 

但是,当出现上述请求时,“ids”参数的值为null。

我已经检查过HttpContext.Current.Request.QueryString有ids的值,我可以这样对待它们,但这会使unit testing变得更难。

我也尝试使用List ids,[FromUri],[FromUri(Name =“ids []”)],对象id和字符串id(有趣的是,当ids是一个字符串变量时,其中的值是“ (采集)”

原来:

 public KeysModel Get([FromUri]int[] ids){...} 

答案毕竟是答案。

不知道我之前在做什么……