简体   繁体   English

什么是<readerquotas>在 WCF 绑定?</readerquotas>

[英]what is <readerQuotas> in WCF Binding?

I gone through this MSDN link but could not get enough details我浏览了这个 MSDN 链接,但无法获得足够的详细信息

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.当我尝试将数据合同 object 发送到服务方法并出现异常时,我遇到了设置远程服务器返回错误:未找到。 , ,

My data contract is having List<>property and was getting exception if list contains 7 object it was working fine with 6 object.我的数据合同具有 List<> 属性,并且如果列表包含 7 object 它与 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.数据合同 object 已到达服务部门进行处理。

The readerQuota settings are used to limit bindings as specified by the attributes. readerQuota 设置用于限制属性指定的绑定。 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.如果请求超过任何这些限制,WCF 服务将自动拒绝请求(我相信在通信堆栈上非常低),以尽可能少地处理请求。

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 .这个想法是服务提交尽可能少的资源来服务请求(如果它超过给定的限制)以帮助抵御拒绝服务攻击 - DDOS

Note that the readQuota limits can be set on both server and client.请注意,可以在服务器和客户端上设置 readQuota 限制。 This allows clients to be protected against fraudulent servers as well as protecting the servers.这允许保护客户端免受欺诈性服务器以及保护服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM