readerQuotas vs WCF web.config中的请求限制 [英] readerQuotas vs request limit in WCF web.config

查看:767
本文介绍了readerQuotas vs WCF web.config中的请求限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将100 MB的数据从客户端应用程序传输到WCF服务。我在我的web.config中设置了 readerQuotas ,但我读了一篇文章,其中建议请求限制,在 http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits 确切的属性是maxAllowedContentLength。

I wish to transfer 100 MB of data from a client application to a WCF service. I've set readerQuotas in my web.config but I read an article where they suggested Request Limits which is briefly explained in http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits the exact property is maxAllowedContentLength.

我想知道有什么不同。

<system.serviceModel>

  <bindings>
    <basicHttpBinding>

      <binding name="PowerTransmissionBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="StreamedRequest" messageEncoding="Mtom">

        <readerQuotas maxDepth="32" maxBytesPerRead="200000000"
        maxArrayLength="200000000" maxStringContentLength="200000000" />

        </binding>
      </basicHttpBinding>
  </bindings>
</system.serviceModel>



requestLimits



requestLimits

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="2000000000" />
  </requestFiltering>
</security>


推荐答案

requestLimits 是一个网络服务器级别设置。当ContentLength(或url length)的请求超出你在那里设置的限制时 - 请求立即被拒绝,404错误,它 甚至进入WCF管道。因此,此配置设置根本与WCF无关。请注意,它限制了请求的总长度,请求中的任何内容都无关紧要。

requestLimits is a web server level setting. When request comes with ContentLength (or url length) which exceeds the limit you set there - request is immediatly rejected with 404 error, it will not even get into WCF pipeline. So, this configuration setting is not related to WCF at all. Note that it limits the overall length of request, whatever is inside the request does not matter.

readerQuotas 是WCF级别设置。它对可由WCF端点处理的SOAP消息的大小施加了各种限制。请注意,现在它是关于SOAP(so,xml)消息而不是关于请求的总长度。这些设置基本上需要使用以特殊方式准备的xml消息来防止针对您的服务的各种拒绝服务攻击。

readerQuotas is WCF level setting. It puts various restrictions on the size of SOAP messages which can be processed by WCF endpoint. Note that now it's about SOAP (so, xml) message and not about overall length of request. Those settings basically needed to prevent various kinds of Denial Of Service attacks against your service using xml messages prepared in a special way.

maxArrayLength - 读取消息时,数组xml阅读器的最大大小可能会返回。这包括字节数组。如果WCF读取的数据大于此值,WCF将停止读取消息并拒绝请求。如果使用类似 byte [] 属性的数据联系人类将文件附加到WCF请求 - 这是限制此类文件大小的设置(但最好不要以这种方式附加文件。)

maxArrayLength - maximum size of array xml reader may return while reading the message. This includes byte arrays. WCF will stop reading message and reject request if it reads an array bigger that this. If you attach files to your WCF requests using something like byte[] properties on your data contact class - this is the setting which will limit the size of such file (but better not attach files in this way).

maxDepth - 消息中xml元素的最大嵌套。

maxDepth - maximum nesting of xml elements in message.

maxNameTableCharCount - 读取器将在读取消息时将一些信息(如名称空间和名称空间前缀)存储在内存中。这限制了这种内存表的大小。

maxNameTableCharCount - reader will store some information (such as namespaces and namespace prefixes) in memory while reading the message. This limits the size of such in-memory table.

maxStringContentLength - SOAP消息中字符串的最大长度。假设您有DataContract类,其中包含一些字符串DataMember属性。如果在反序列化期间发生此字符串超出限制 - 消息将被拒绝。

maxStringContentLength - maximum length of a string inside SOAP message. Suppose you have DataContract class with some string DataMember property. If during deserializing it happens that this string exceeds the limit - message would be rejected.

maxBytesPerRead - 基本上是任何xml元素的最大长度(包括所有的孩子)。

maxBytesPerRead - basically maximum length of any xml element (including all it's children).

这篇关于readerQuotas vs WCF web.config中的请求限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆