I have am having an issue when attempting to return JSON data from a WCF Service. I have tracked the issue down to the ResponseFormat:=WebMessageFormat.JSON, but I am unable to make any further progress.
I am wanting the return types of my service to be an interface so that I have a little more control over the responses that are coming to my application.
I know that returning an interface requires the ServiceKnownType and requires KnowsType on the objects so that they can serialize properly. I have an example working, however, when add a property with a class that inherits from iList things go bad.
The service returns nothing. I have confirmed via Fiddler that the content-length of the response is 0. However if I switch the ResponseFormat to WebMessageFormat.XML it works fine and all objects are returned. I have included as much
code (and probably more) as I think is necessary. If something else is needed, let me know.
Any insight is greatly appreciated.
If you comment out the DataMember Attribute on the Values property in TestResult class you will see that the code works perfectly when returning JSON.
If you change the return Type of the Values Property to be TestCollection instead of ITestCollection it works as well.
View Complete Post