BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WSCF/WCF

 
 
Page 7980 of 20224

The maximum nametable character count quota (16384) has been exceeded

Blogger : Claras Notes on Technology
All posts : All posts by Claras Notes on Technology
Category : WSCF/WCF
Blogged date : 2007 Aug 20

It has been a while since I last posted, but I haven't stopped working :) I am currently on a project involving WPF and WCF. While I am not a big fan of WPF, but I quite like WCF.

During the development of our project we run into a very annoying problem with WCF. After some help from Microsoft, we found a solution at last.

The problem is very easy to describe. On the one side, we have a WCF service running. On the other side, we have a client with a reference with to this service. Now and then, we need to update the service reference (because the service includes new features, for example). You can do this with svcutil or by right clicking on the reference in VisualStudio and choosing the "Update Service Reference" option.

One day, when updating the reference (with svcutil) we got this message:

Error: Cannot obtain Metadata from http://localhost:8000/businessservice/service/mex

The maximum nametable character count quota (16384) has been exceeded whilereading 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.

After several Google searches, I thought this could be solved by increasing the reader quotas parameters for the metadata exchange binding. This implied some minor changes in the service config file since the the mexBinding configuration section does not provide any properties: you have to use a wsHttpBinding without any security. This is explained here and Michele Leroux Bustamante (an expert on WCF) even provides a couple of samples (config-based sample here, and code-based sample here).

However, this did not help at all. Even setting the reader quotas to the maximum possible values made no difference at all. In the end, Microsoft told me what was wrong: the message refers to the svcutil reader quotas not the service ones! Svcutil has a limit on how much metadata it can read. This limit can be changed with a config file.

The solution is to create a config file for svcutil (see below) and place it in the same folder as the tool. Next time you run svcutil, the config file values will be taken into account.

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="MyBinding">
                    <textMessageEncoding>
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    </textMessageEncoding>
                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint binding="customBinding" bindingConfiguration="MyBinding"
                contract="IMetadataExchange"
                name="http" />
        </client>
    </system.serviceModel>
</configuration>

 

The MSDN WCF samples contain an example of creating this config file, although the main issue is a different one (how to configure svcutil to fetch metadata from a custom endpoint), so it wasn't so obvious to make the connection.

 

Technorati tags: WCF, svcutil


Read comments or post a reply to : The maximum nametable character count quota (16384) has been exceeded
Page 7980 of 20224

Newest posts
 

    Email TopXML