BasicHttpBinding.ReaderQuotas 屬性

定義

取得或設定 SOAP 訊息複雜性的條件約束,而這些條件約束可由以此繫結所設定的端點處理。

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

屬性值

指定複雜性條件約束的 XmlDictionaryReaderQuotas

範例

下列範例會將 ReaderQuotas 設定為應用程式設定。

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

binding.ReaderQuotas = readerQuotas;

這個屬性的值也可以在組態檔中設定。

<configuration>
  <system.serviceModel>

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

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

  </system.serviceModel>

</configuration>

備註

複雜性條件約束可以防止受到阻絕服務 (DOS) 攻擊,這種攻擊會嘗試使用訊息的複雜性來困住端點處理資源。 其他複雜性條件約束包含最大項目深度和訊息內最大字串內容長度等項目。

適用於