2010-08-05 57 views
0

我有一個具有這些配置設置的WCF服務。當我從客戶端應用程序調用它時,我仍然遇到了可怕的問題,「在對象圖中可以序列化或反序列化的項目的最大數目是'65536'」「我的配置下面出現了什麼問題?WCF maxReceivedMessageSize不工作

<system.serviceModel> 
    <bindings> 
    <wsHttpBinding> 
    <binding name="LargeBuffer" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"> 
    <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" 
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> 
    </binding> 
    </wsHttpBinding> 
    </bindings> 
    <services> 
    <service behaviorConfiguration="ServiceBehavior" name="TestWcfService.Service1"> 
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="LargeBuffer" name="ServiceEndPoint" 
     contract="TestWcfService.IService1"> 
     <identity> 
     <dns value="localhost" /> 
     </identity> 
    </endpoint> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
    <behavior name="ServiceBehavior"> 
    <serviceMetadata httpGetEnabled="true" /> 
    <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 
+2

你增加了maxItemsInObjectGraph配額超出雙方的發送(序列化)和接收(反序列化)邊它的默認值?它適用於讀取和寫入數據。 – 2010-08-05 02:58:11

+0

相同的配置是否也適用於您的客戶?你只顯示服務器端的配置 - 雙方都需要有新的設置才能工作。 – 2010-08-05 05:06:37

+0

我是否必須基本上覆制配置文件之間的所有內容,然後Myles? – DevDave 2013-05-24 16:53:53

回答

1

是的我增加了它在客戶端的匹配。它仍然達到了這個極限。我擔心的是,當它將服務參考拉回時,它仍將65536視爲默認大小,因此它永遠不會識別更大的數量。有什麼想法嗎?

0

這裏是我的客戶端代碼:

<system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="ServiceEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00" 
        receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
        transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
        maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" 
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
        allowCookies="false"> 
        <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
         maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
        <reliableSession ordered="true" inactivityTimeout="00:10:00" 
         enabled="false" /> 
        <security mode="Message"> 
         <transport clientCredentialType="Windows" proxyCredentialType="None" 
          realm=""/> 
         <message clientCredentialType="Windows" negotiateServiceCredential="true" 
          algorithmSuite="Default" establishSecurityContext="true" /> 
        </security> 
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:61423/Service1.svc" binding="wsHttpBinding" 
       bindingConfiguration="ServiceEndPoint" contract="LucasImport.IService1" 
       name="ServiceEndPoint"> 
       <identity> 
        <dns value="localhost" /> 
       </identity> 
      </endpoint> 
     </client> 
    </system.serviceModel>