Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is <readerQuotas> in WCF Binding?

I gone through this MSDN link but could not get enough details

Can any one explain me with a scenario where and why i need to set this value.

I came across the setting when i was trying to send a Data Contract object to service method and was getting exception The remote server returned an error: Not Found.,

My data contract is having List<>property and was getting exception if list contains 7 object it was working fine with 6 object.

I guess it was issue with Size of Data Contract.

When i changed my binding in config file

<readerQuotas maxDepth="64" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="4096" />

to

<readerQuotas maxDepth="128" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="4096" />

the Data Contract object reached to Service for processing.

like image 540
PramodChoudhari Avatar asked Feb 02 '23 17:02

PramodChoudhari


1 Answers

The readerQuota settings are used to limit bindings as specified by the attributes. If a request exceeds any of those limits the WCF service will automatically reject the request (very low on the comms stack I believe) to do as little processing on the request as is possible.

The idea being that the service commit as few resources as possible to service the request (if it exceeds a given limit) to help fend off Denial-of-Service attacks - DDOS.

Note that the readQuota limits can be set on both server and client. This allows clients to be protected against fraudulent servers as well as protecting the servers.

like image 95
Smudge202 Avatar answered Feb 06 '23 14:02

Smudge202