語言

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)攻擊。 其他複雜度限制包括訊息中字串內容的最大元素深度與最大長度。

適用於