2011-10-18 22 views
1

嘗試反序列化郵件時格式化程序引發異常:嘗試反序列化參數http://tempuri.org/:GetFileResult時發生錯誤。 InnerException消息是'反序列化WindowsClient.CloudServiceProxy.GetFileResponse類型的對象時發生錯誤。讀取XML數據時,超出了最大數組長度限額(16384)。可以通過更改創建XML閱讀器時使用的XmlDictionaryReaderQuotas對象的MaxArrayLength屬性來增加此配額。 1號線,位置41572.'。有關更多詳細信息,請參閱InnerException。 我得到這個問題的 服務器的web.config是WCF Web服務中的最大閱讀器配額問題

<system.serviceModel> 
    <services> 
    <service behaviorConfigura 

tion="CloudServiceBehaviour" name="Web.CloudService"> 
     <endpoint name="CloudServiceClientEndPoint" bindingConfiguration="CloudBindingConfig" address="http://localhost:53243/CloudService.svc" binding="wsHttpBinding" contract="Web.ICloudService"></endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="CloudServiceBehaviour"> 
      <serviceMetadata httpGetEnabled="True" httpGetUrl=""/> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 

     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="CloudBindingConfig" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <readerQuotas maxDepth="200" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    </system.serviceModel> 

和客戶端的web.config是,

<system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="CloudServiceClientEndPoint" closeTimeout="00:01:00" 
openTimeout="00:01:00" receiveTimeout="00:30: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="2147483647" maxStringContentLength="2147483647" 
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
       <reliableSession ordered="true" inactivityTimeout="00:30:00" 
        enabled="false" /> 
       <security mode="Message"> 
        <transport clientCredentialType="Windows" proxyCredentialType="None" 
        realm="" /> 
        <message clientCredentialType="Windows" negotiateServiceCredential="true" 
        algorithmSuite="Default" /> 
       </security> 
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:53243/CloudService.svc" binding="wsHttpBinding" 
      contract="CloudServiceProxy.ICloudService" name="CloudServiceClientEndPoint" /> 
     </client> 
    </system.serviceModel> 
+1

在您的客戶端web.config嘗試添加到您的 bindingConfiguration =「CloudServiceClientEndPoint」 – MLF

回答

2

由於錯誤而反序列化對象GetFileResponse,告訴你問題位於客戶端堆棧中。

您的客戶端綁定使用wsHttpBinding的默認配置,因爲您已省略在端點上指定bindingConfiguration名稱。嘗試將bindingConfiguration="CloudServiceClientEndPoint"添加到端點元素,然後讀取您的readerQuotas設置的較大值。

+0

是的,這是我失蹤的設置。它添加此設置後爲我工作。謝謝。 – Selwyn