On only really large collections the following line throws an OutofMemroyException at mscorlib.dll at server level
HttpResponseMessage response;
response.Content= new StringContent(JsonConvert.SerializeObject(results),
system.Encoding.UTF8, "text/json");
However the following method serializing the same object dose not produces this error
Var serializer= new System.Web.Script.Serilaization.JavascriptSerializer()
{MaxJsonLength = int.MaxValue};
response.Content= new StringContent(serializer.Serialize(results),
system.Encoding.UTF8, "text/json")
However with second method the client throws the error:
Cannot deserialize the current json array because the the type requires a json object
So I am hoping either solve the memory issue with the first method or figure out why the second method can bot be deserialized like the first method
Thanks