“;读取XML数据时已超过最大字符串内容长度配额(8192)”;向WCF发送字符串时出错

“;读取XML数据时已超过最大字符串内容长度配额(8192)”;向WCF发送字符串时出错,wcf,request,content-length,Wcf,Request,Content Length,关于上述问题,我提到了几个stackoverflow线程,但即使在应用了上述解决方案之后,我仍然会得到相同的错误 我根据和调整了设置,因此客户端中的web.config和WCF服务中的app.config如下所示: web.config: <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMe

关于上述问题,我提到了几个stackoverflow线程,但即使在应用了上述解决方案之后,我仍然会得到相同的错误

我根据和调整了设置,因此客户端中的web.config和WCF服务中的app.config如下所示:

web.config:

 <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>

您还需要在服务器端设置相同的配置。 在app.config中添加绑定配置:

 <system.serviceModel>
    <!-- add the lines below -->
    <bindings>
      <wsHttpBinding>
         <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
      </wsHttpBinding>
    </bindings>

还要更改Web.config:

 <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>


希望它有帮助

我看到您调整了邮件大小,但我没有看到maxBufferSize=“20481000”maxBufferPoolSize=“524288”。在不增加缓冲区的情况下,更改最大消息大小是没有意义的。当我添加maxBufefrSize时,我得到一个错误,表明这是不允许的。此属性似乎不适用于wsHttpBinding.Ok。所以根据这个()你可以试着玩maxBufferPoolSize only,我做了。我也试过里卡多的指示。问题仍然存在:(我已经更新了我的答案,包括绑定标记中的maxBuffer和maxReceive,请检查。正如我在Mimas的帖子中所说,maxBufferSize不是wsHttpBinding的有效属性。是的,你是对的,wsHttpBinding中只使用了maxBufferPoolSize,对不起。