Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi

I am trying to save save a fairly large string to the database. I send the required information to the server but I get the following error:

There was an error deserializing the object of type AASC.DAL.Types.EventDTO. 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.

I add the following to the relevant section of my service's web.config:

<textMessageEncoding>
<readerQuotas maxStringContentLength=”2147483647″/>
</textMessageEncoding>

Now, my service doesn't compile. it builds fine with no errors, but gives me the following error:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

Here is the serviceModel section of my web.config:
XML
<bindings>
      <customBinding>
        <binding name="AASC.DAL.AASCData.customBinding0">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
          <textMessageEncoding>
            <readerQuotas maxStringContentLength="2147483647" />
          </textMessageEncoding>
        </binding>
      </customBinding>
    </bindings>

As soon as I remove that attribute from my web.config it works fine, but with the string limit at 8192.

Any suggestions?
Posted
Updated 14-Feb-12 22:20pm
v2
Comments
Rajeev Jayaram 13-Feb-12 7:09am    
I believe you may not have added the readerQuotas at the right section. Would you post your serviceModel part of your config file, that might give some clue.
DominicZA 15-Feb-12 4:21am    
I updated my question. Please see if it helps in any way!

1 solution

Try not to use both bindings together.
Use only binary binding.

HTML
      <custombinding>
        <binding name="AASC.DAL.AASCData.customBinding0">
          <binarymessageencoding maxreadpoolsize="2147483647" maxsessionsize="2147483647" maxwritepoolsize="2147483647">
            <readerquotas maxstringcontentlength="2147483647" />
          </binarymessageencoding>
</binding></custombinding>
 
Share this answer
 
Comments
DominicZA 15-Feb-12 4:45am    
If I could mark this as solution a million times over I would! If you would be so kind as to explain to me why it was not working, or point me in a direction where I can read up on it.

Thank you again!
Abhinav S 15-Feb-12 5:00am    
SImply put, one binding configuration supports only one type of encoding. You were setting two within the same custom binding configuration.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900