3

I have a WCF rest service using webHttpBinding that returns JSON result. The problem is that I can't return large JSON results. Works great for smaller results, but at about 1.16MB result size, I get empty responce. Fiddler gives me this:

HTTP/1.1 504 Fiddler - Receive Failure
Content-Type: text/html; charset=UTF-8
Connection: close
Timestamp: 15:57:24.251

[Fiddler] ReadResponse() failed: The server did not return a response for this request.

Chrome gives me 'Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.'

I tried to set every option in binding and readerQuotas section of web.config that starts with 'max' but it did not work. I host the WCF service in IIS but the same thing happens in self-hosted service.

How do I increase max sent JSON result?

1 Answer 1

7

in your service behavior, try playing around with the maxItemsInObjectGraph:

<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="123456" />
4
  • It worked! Thank you and sorry for late reply, I only had time to test it now. Mar 5, 2012 at 14:40
  • That's good, I'm happy it worked. Could you set the answer to accepted then? Thanks!
    – RoelF
    Mar 5, 2012 at 16:01
  • 1
    Thank you, thank you, thank you I have been struggling with this for an long time and it has caused me a lot of pain. Out of interest why have you set the maxItemsInObjectGraph to "123456" it works but I want to know why it works.
    – Grenter
    Jan 29, 2013 at 16:46
  • You can set it to the max size of Int32.MaxValue. The maximum number of items to serialize or deserialize. msdn.microsoft.com/en-us/library/… Dec 14, 2013 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.