Is there a size limit for WCF WebInvoke Response?

I have a WCF web service defined as follows

[OperationContract]
[WebInvoke(
    Method = "GET",
    ResponseFormat = WebMessageFormat.Json,
    BodyStyle = WebMessageBodyStyle.Bare,
    UriTemplate = "Assets/{assetId}/Reports/{startDate}/{endDate}")]
JQGridDataStore<Report> GetReportsForAssetFilterByDate(string assetId, string startDate, string endDate);

I have no problem getting answers when my JQGridDataStore contains thousands of report instances. However, the data warehouse exceeds 10,000 reports, in my browser I get the following:

Error 324 (net :: ERR_EMPTY_RESPONSE): Unknown error.

I am implementing a service and I can see how it goes through all exceptions. The JQGridDataStore object is fully created and populated with my 10,000 + Report instances. However, when I 'F10' past the return, the browser shows an empty response. All this happens in a second, so I don’t think I have any kind of timeout.

Based on this, I think that there is a certain type of buffer size limit that I encounter. What restrictions exist and how to configure them?

+3
source share
2 answers

You probably fall into the DataContractJsonSerializer MaxItemsInObjectGraph quota (each individual object - if you have several complex types in your array, 10k of them will easily fall into this limit). You can set it in a behavior configuration such as this .

However, I suggest you take a look at the swap metaphor. Nobody wants to wait until all these things fall in one shot. :)

+6
source

web.config , , maxReceivedMessageSize :

<bindings>
  <webHttpBinding>
    <binding name="myWebHttpBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
    </binding>
  </webHttpBinding>
</bindings>

, - 65536, , , .

, !

+2

Source: https://habr.com/ru/post/1754876/


All Articles