I hate WCF setup with endpoints, behaviors etc. I believe all these things should be performed automatically. All I want to do is to return JSON result from my WCF service. Here
In your WebGet
or WebInvoke
Specify your BodyStyle
to WrappedRequest
, then remove the UriTemplate
. When Invoking your service use the function name.
Hope it helps.
Example:
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
void register(string name, string surname);