title: Sending object to WCF service. MaxStringContentLength (8192 bytes) exceeded when deserializing
body: <p>I created a simple WCF web service that has one method: SubmitTicket(flightticket ft, string username, string password)</p>
  
  <p>On the client side, I have an application for filling out a form (a flight ticket) and sending it to this newly created web service. When this flightticket object exceeds 8192bytes I get the following error:</p>
  
  <p>"There was an error deserializing the object of type flightticket. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader"</p>
  
  <p>I did some research online and found that I have to set the MaxStringContentLength in the web.config (server) and app.config (client) to a higher number. Problem is, I've tried every possible combination of settings in both config files from reading various blogs and sites, but it STILL fails on that same error!</p>
  
  <p>I have attached my client and server config code (as it is at the moment, it has gone through many many many changes over the day with no success).</p>
  
  <p>One thing I noticed is that the configuration.svcinfo file on my client application seems to always shows 8192 for MaxStringContentLength when I update the service reference. It appears to take all the default values even if I explicitly set the binding properties. Not sure if that is related to my problem at all, but worth mentioning.</p>
  
  <hr>
  
  <p>Here is the applicable app.config/web.config code for defining the endpoint bindings:</p>
  
  <p>&lt;&lt;&lt;&lt;&lt; CLIENT >>>>></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;configSections&gt;
  &lt;/configSections&gt;
  &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="BasicHttpBinding_IFlightTicketWebService" 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"&gt;
                  &lt;readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384"
                      maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                  &lt;security mode="None"&gt;
                      &lt;transport clientCredentialType="None" proxyCredentialType="None"
                          realm="" /&gt;
                      &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
          &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="http://xx.xx.xx/xxxxxxxx.svc"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFlightTicketWebService"
              contract="FlightTicketWebService.IFlightTicketWebService"
              name="BasicHttpBinding_IFlightTicketWebService" /&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>&lt;&lt;&lt;&lt;&lt; SERVER >>>>></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  &lt;configSections&gt;
  &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
    &lt;section name="GSH.FlightTicketWebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
  &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  &lt;system.web&gt;
  &lt;httpRuntime maxRequestLength="16384"/&gt;
  &lt;compilation debug="true" targetFramework="4.0"/&gt;
  &lt;pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/&gt;
  &lt;/system.web&gt;
  
  &lt;system.serviceModel&gt;
    &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
            &lt;binding name="BasicHttpBinding_IFlightTicketWebService" 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"&gt;
                &lt;readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                &lt;security mode="None"&gt;
                    &lt;transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" /&gt;
                    &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                &lt;/security&gt;
            &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
    &lt;/bindings&gt;
  &lt;behaviors&gt;     
  &lt;serviceBehaviors&gt;        
  &lt;behavior&gt;
  &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true"/&gt;
  &lt;services&gt;
      &lt;service name="FlightTicketWebService"&gt;
          &lt;endpoint 
              name="FlightTicketWebServiceBinding"
              address="http://xx.xx.xx/xxxxxxxxxxx.svc" 
              binding="basicHttpBinding" 
              bindingConfiguration="BasicHttpBinding_IFlightTicketWebService"
              contract="IFlightTicketWebService"/&gt;
      &lt;/service&gt;
  &lt;/services&gt;
  &lt;/system.serviceModel&gt;
  &lt;system.webServer&gt;
  </code></pre>