0

When i try communicating with my WCF service i get the following error:

The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 4, position 283.

I tried increasing my maxNameTableCharCount by adding readerQuotas as suggested here but i still get the same error.

...
<bindings>
    <basicHttpBinding>
        <binding name="oseo_basicHTTP_binding">
            <readerQuotas maxDepth ="2147483647"
                maxStringContentLength="2147483647"
                maxArrayLength="2147483647"
                maxBytesPerRead="2147483647"
                maxNameTableCharCount="2147483647" />
        </binding>
    </basicHttpBinding>
</bindings>
<services>
    <service name="oseo">
        <host>
            <baseAddresses>
                <add baseAddress="http://localhost:56565/" />
            </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="oseo_basicHTTP_binding" contract="Ioseo" />
        <endpoint
            address="mex"
            binding="mexHttpBinding"
                contract="IMetadataExchange" />
    </service>
</services>
...

EDIT #1: Some background info:

This web.config is on the service side. I'm using SoapUI as the client and not a .NET client.

Community
  • 1
  • 1
capdragon
  • 14,565
  • 24
  • 107
  • 153
  • Does the max-value in the exception message change? You may inadvertently have configured the wrong binding. – faester Jan 23 '12 at 16:49
  • @faester : How do i fix this? I only have one binding don't I? – capdragon Jan 23 '12 at 16:57
  • You have two - one for the service, and one for the client. Which binding did you change, client or service? – Tim Jan 23 '12 at 18:13
  • @Tim : This is all Server Side. The only client i'm using to test is the SOAP UI client (use it all the time) which mines the service's wsdl and generates the messages automatically. No Web-config. – capdragon Jan 23 '12 at 18:25
  • @capdragon - Then the only way I see for you to test your service is to write a quick client yourself, so you can set the binding values to non-default values, if there's no config file to modify or any way for you to tweak the settings (which it sounds like there isn't). – Tim Jan 23 '12 at 18:30
  • Well, i created a new project, imported the code, rebooted my computer and it seems to be working now. :/ I'll close this. – capdragon Jan 23 '12 at 20:57
  • Hmmm.... would be nice to know what the root cause was. I had this question favourited :) – Nick Ryan Jan 24 '12 at 11:41
  • @NickRyan : ooops sorry, i can't seem to take back my close request. – capdragon Jan 24 '12 at 13:49
  • @NickRyan : Actually, it's back. Now i want to know what is going on. – capdragon Jan 24 '12 at 14:37
  • Have you tried increasing the MaxObjectsInItemGraph as well? – Rajesh Jan 24 '12 at 16:15
  • @Rajesh : I just tried adding `` to my behavior section of web.config but i get the exact same error :/. – capdragon Jan 24 '12 at 16:21
  • Can you try to post the request from Fiddler to see if you get back the same error. – Rajesh Jan 24 '12 at 16:29
  • 1
    Is the error happening server-side or client-side? – Joel C Jan 24 '12 at 16:57
  • I could have sworn I saw this same question yesterday...my advice is still the same. It sounds like you can't alter the settings on the binding for the client, so create a console app as a test client and set the higher values in the app.config. – Tim Jan 24 '12 at 17:08
  • The error is happening server-side but it is being displayed to the client. The client is just the messenger. @Tim : Yes, the error was posted yesterday.I had created a new project and that slimmed the messages down enough to go under the quota (16384). So i closed the post... as soon as i kept importing all the business objects and stuff it went over that quota. And the error re-appeared and so did this new, but same question. I created a console app but [i'm having other issues with that](http://goo.gl/sflsv). It needs to be platform independent so the app.config cannot be a solution. – capdragon Jan 24 '12 at 17:25

1 Answers1

1

Make sure that you have the fully-qualified name of the service class in the name attribute of the <service> element. Your contract class is on the DataContract namespace (DataContract.Ioseo). If the service class is also in the same namespace, this is what you need to have:

<services>
  <service name="DataContract.OSEOService">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:51515/" />
      </baseAddresses>
    </host>
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="oseo_basicHTTP_binding"
              contract="DataContract.Ioseo" />
    <endpoint
        address="mex"
        binding="mexHttpBinding"
        contract="IMetadataExchange" />
</service>
carlosfigueira
  • 85,035
  • 14
  • 131
  • 171