2011-11-15 46 views
1

對於存在於URI中的輸入參數必須是REST Webservice中的字符串的數據類型是否存在限制?REST Web服務方法中的數據類型限制

我正在創建一個REST Webservice。該方法有一個輸入參數ID,這也存在於URI中。 如果我將類型更改爲整數,則在調用它時會生成錯誤。

Operation 'Get' in contract 'IService1' has a path variable named 'id' which does not have type 'string'. Variables for UriTemplate path segments must have type 'string'. 

回答

1

在.net 4中的WCF REST無法進行此轉換,但是WCF Web API可以。 http://wcf.codeplex.com

這與REST的任何約束無關,它純粹是實現框架的限制。