【发布时间】:2011-07-07 20:41:09
【问题描述】:
ly资源的定义
[OperationContract]
[WebGet(UriTemplate = "getbydaterange/{insId}/{startDate}/{endDate}", ResponseFormat = WebMessageFormat.Json)]
List<RestfulServiceObj> GetMyObjectsByDateRange(string insId, string startDate, string endDate);
如何使最后两个参数可选?即,我希望最后三个调用起作用
"http://domain.com/service.svc/myid/"
"http://domain.com/service.svc/myid/07-07-2011"
"http://domain.com/service.svc/myid/01-01-2011/07-08-2011"
但只有最后一个调用有效,其余的则给出缺少参数的错误。
谢谢 看涨
【问题讨论】:
-
您的 .NET 框架版本是什么? I tested this before 在
UriTemplate的查询字符串中带有string和int参数并且它起作用了。