相关疑难解决方法(0)

读取XML数据时已超出最大字符串内容长度配额(8192)

我正在尝试将一个大字符串(24,000到50,000个字符)传递给自托管的TCP WCF服务.

我已经将maxStringContentLength(无处不在)提升到了22008192.

我在某处读到我需要将bindingConfiguration更改为"LargeBuffer"或"LongFields",但是当我这样做时:

<endpoint address="" binding="netTcpBinding" bindingConfiguration="LongFields"
  contract="ExStreamWCF.IService1">
Run Code Online (Sandbox Code Playgroud)

或这个:

<endpoint address="" binding="netTcpBinding" bindingConfiguration="LargeBuffer"
  contract="ExStreamWCF.IService1">
Run Code Online (Sandbox Code Playgroud)

我的服务无法启动.我真的需要这个错误才能消失.有任何想法吗?

谢谢,

贾森

PS - 服务器上tcp服务的配置文件:

<system.serviceModel>
<services>
  <service behaviorConfiguration="ExStreamWCF.Service1Behavior"
    name="ExStreamWCF.Service1">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      contract="ExStreamWCF.IService1">
      <identity>
        <dns value="Devexstream-2.anchorgeneral.local" />
        <!--<dns value="vmwin2k3sta-tn2" />-->
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://Devexstream-2:8080/Service" />
        <!--<add baseAddress="net.tcp://vmwin2k3sta-tn2:8080/Service" />-->
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ExStreamWCF.Service1Behavior">
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)

编辑:根据要求绑定

    <system.serviceModel>
    <bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService1" closeTimeout="00:01:00"
 openTimeout="00:01:00" receiveTimeout="00:10:00" …
Run Code Online (Sandbox Code Playgroud)

string wcf quota long-integer

27
推荐指数
1
解决办法
4万
查看次数

最大字符串内容长度配额(8192)

为操作'CreateTransactionEntity'反序列化回复消息体时出错.读取XML数据时已超出最大字符串内容长度配额(8192).通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxStringContentLength属性,可以增加此配额.

嘿,即使我的web.config文件中有一个比生命更长的readerQuota节点,我仍然会收到此错误...

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="BindingTcp"  maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" closeTimeout="00:10:00">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </netTcpBinding>
Run Code Online (Sandbox Code Playgroud)

在浏览了这个主题的互联网后,我似乎无法得到一个体面的答案.如果您有任何建议我会非常感激.

wcf readerquotas

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

wcf ×2

long-integer ×1

quota ×1

readerquotas ×1

string ×1