2014-06-24 1 views
1

j'ai eu l'exception suivante lorsque vous travaillez avec XMLs dans une application WCF:Pourquoi le fichier dataContractSerializer ne résout-il pas System.ServiceModel.Dispatcher.NetDispatcherFaultException?

System.ServiceModel.Dispatcher.NetDispatcherFaultException: Le formatter une exception a jeté tout en essayant de désérialiser le message:

Après avoir ajouté la partie suivante de DataContractSerializer cela ne fonctionne pas. Toujours avoir l'erreur. Mon app.config ressemble à ceci après avoir ajouté DataContractSerializer:

configuration> 
<system.serviceModel> 
    <behaviors> 
    <endpointBehaviors> 
     <behavior name="Graph"> 
     <dataContractSerializer maxItemsInObjectGraph="1000000000"/> 
     </behavior> 
    </endpointBehaviors> 
    </behaviors> 
    <bindings> 

     <basicHttpBinding> 

      <binding name="BasicHttpBinding_IBrokerService" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
       useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 

      </binding> 

     </basicHttpBinding> 

    </bindings> 
    <client> 
     <endpoint address="http://mx4p2/test1/test2.svc" binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpBinding_TestService" contract="Proxy.TestService" 
      name="BasicHttpBinding_TestService" behaviorConfiguration="Graph" /> 
    </client> 



</system.serviceModel> 

Répondre

1

Vous pourriez éviter l'exception simplement en augmentant la valeur de maxStringContentLength. Pas besoin de comportements.

+0

qui l'a résolu. Merci :) –

Questions connexes