Can I pass non-string to WCF RESTful service using UriTemplate?

前端 未结 4 618
我在风中等你
我在风中等你 2020-12-02 21:54

Can I do the following?

[OperationContract]
[WebGet(UriTemplate = \"/foo/{id}\")]
string GetFoo(int id);

I\'d like my service to function a

4条回答
  •  庸人自扰
    2020-12-02 22:30

    If I remember correctly, UriTemplate variables in the path always resolve to strings when using WebGet or WebInvoke. You can only bind UriTemplate variables to int, long, etc. when they are in the query portion of the UriTemplate.

提交回复
热议问题