我想创建WCF Restful服务,它将Complex Type作为Json格式的参数并返回Json.我阅读了很多文章并在网上查看了很多样本.有些文章建议在Endpoint行为中添加标签并装饰Service方法,如下所示,
[WebInvoke(UriTemplate = "/PlaceOrder", RequestFormat= WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")]
在这种情况下,WCF返回"Endpoints using 'UriTemplate' cannot be used with 'System.ServiceModel.Description.WebScriptEnablingBehavior'."
错误消息.
另一种建议的方式(如本文http://dotnetmentors.com/wcf/wcf-rest-service-to-get-or-post-json-data-and-retrieve-json-data-with-datacontract.aspx)将""标记添加到Endpoint行为而不是.但在这种情况下IIS返回("远程服务器返回错误:(400)错误请求.")错误消息.
你能帮我解决一下如何创建Restful Service,它采用json格式的复杂类型参数并返回json.