Click here to Skip to main content
13,252,815 members (49,545 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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:

<readerQuotas maxStringContentLength=”2147483647″/>

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:
        <binding name="AASC.DAL.AASCData.customBinding0">
          <binaryMessageEncoding />
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
            <readerQuotas maxStringContentLength="2147483647" />

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

Any suggestions?
Posted 13-Feb-12 1:00am
Updated 14-Feb-12 23:20pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

        <binding name="AASC.DAL.AASCData.customBinding0">
          <binarymessageencoding maxreadpoolsize="2147483647" maxsessionsize="2147483647" maxwritepoolsize="2147483647">
            <readerquotas maxstringcontentlength="2147483647" />
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 15 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100