已超出最大命名表字符数配额 (16384)

发布于 2024-12-28 12:44:30 字数 1624 浏览 1 评论 0原文

当我尝试与 WCF 服务通信时,出现以下错误:

已超出最大命名表字符数配额 (16384) 读取 XML 数据时。名称表是一种数据结构,用于 存储 XML 处理过程中遇到的字符串 - 长 XML 文档 具有不重复的元素名称、属性名称和属性值 可能会触发此配额。该配额可以通过更改 XmlDictionaryReaderQuotas 对象的 MaxNameTableCharCount 属性 创建 XML 读取器时使用。第 4 行,位置 283。

我尝试通过添加 readerQuotas 如此处建议的,但我仍然遇到相同的错误。

...
<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>
...

编辑#1: 一些背景信息:

此 web.config 位于服务端。我使用 SoapUI 作为客户端,而不是 .NET 客户端。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒芜了季节 2025-01-04 12:44:30

确保您在 name 属性中拥有服务类的完全限定名称代码> 元素。您的合约类位于 DataContract 命名空间 (DataContract.Ioseo) 上。如果服务类也在同一命名空间中,则您需要具有以下内容:

<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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文