簡體   English   中英

基本HttpBinding的WCF服務配置

[英]WCF Service Configuration for basicHttpBinding

我有一個SOA,其中一個網站使用服務,另一個網站托管服務。 我的一項服務接受圖像(byte [])。 當我將83kb的圖像傳遞給WCF服務時,出現以下錯誤:

讀取XML數據時,已超出最大數組長度配額(16384)。 通過更改在創建XML閱讀器時使用的XmlDictionaryReaderQuotas對象上的MaxArrayLength屬性,可以增加此配額。

我的服務器端配置中沒有針對此服務的特定配置。 以下是我正在使用的Web應用程序的web.config文件:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
          <binding name="BasicHttpBinding_ISchoolSettings" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="false">
          <readerQuotas maxDepth="32" maxStringContentLength="998192" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:50977/Interface/Schools.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISchoolSettings" contract="Services.Schools.ISchoolSettings" name="BasicHttpBinding_ISchoolSettings" />
    </client>
  </system.serviceModel>

似乎.net忽略了我已為此綁定配置設置MaxArrayLength=2147483647的事實。

我在這里使用.net 4.0 奇怪的是,我有一台機器上裝有.net 4.5 ,但我沒有在該機器上收到此錯誤!

我已經嘗試了各種方法,但似乎無法解決該問題。

確保同時更改客戶端配置和服務配置上的設置。 有時看到實際發生異常的地方可能會使您感到困惑。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM