BasicHttpBinding.ReaderQuotas BasicHttpBinding.ReaderQuotas BasicHttpBinding.ReaderQuotas BasicHttpBinding.ReaderQuotas Property

定义

获取或设置可由配置了此绑定的终结点处理的 SOAP 消息的复杂性约束。Gets or sets constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding.

public:
 property System::Xml::XmlDictionaryReaderQuotas ^ ReaderQuotas { System::Xml::XmlDictionaryReaderQuotas ^ get(); void set(System::Xml::XmlDictionaryReaderQuotas ^ value); };
public System.Xml.XmlDictionaryReaderQuotas ReaderQuotas { get; set; }
member this.ReaderQuotas : System.Xml.XmlDictionaryReaderQuotas with get, set
Public Property ReaderQuotas As XmlDictionaryReaderQuotas

属性值

示例

下面的示例将 ReaderQuotas 设置为应用程序设置。The following example sets ReaderQuotas to application settings.

BasicHttpBinding binding = new BasicHttpBinding();
XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
readerQuotas.MaxArrayLength = 25 * 1024;

binding.ReaderQuotas = readerQuotas;

也可以在配置文件中设置此属性的值。The value of this property can also be set in the configuration file.

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1">
          <readerQuotas maxBytesPerRead ="1000" 
                        maxDepth="100"/>

          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>

</configuration>

注解

复杂性约束可以抵御拒绝服务 (DOS) 攻击,这些攻击试图利用消息复杂性来占用终结点处理资源。The complexity constraints provide protection from denial of service (DOS) attacks that attempt to use message complexity to tie up endpoint processing resources. 其他复杂性约束包括多个项,例如最大元素深度和消息中的字符串内容的最大长度。Other complexity constraints include items such as a maximum element depth and a maximum length for string content within the message.

适用于