WCF RestFull提交数据超出限额解决方法

最近在使用wcf restfull时出现了超大数据提交出错的问题。web

服务端会返回错误:服务器处理请求时遇到错误。有关构造有效服务请求的内容,请参阅服务帮助页。异常消息为“反序列化对象 属于类型 YesWayClientAPI.TourRecord.Model.TourRecordSaveTrackRequest 时出现错误。读取 XML 数据时,超出最大字符串内容长度配额 (8192)。经过更改在建立 XML 读取器时所使用的 XmlDictionaryReaderQuotas 对象的 MaxStringContentLength 属性,可增长此配额。”。服务器

lALOIsonHnnNAew_492_121

这时咱们能够经过配置web.config来解决这个问题:restful

在web.config中的<system.serviceModel>节点下添加下面配置项:大数据

<standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint  name="" transferMode="StreamedRequest" helpEnabled="true"  maxReceivedMessageSize="10485760" automaticFormatSelectionEnabled="true"                                  defaultOutgoingResponseFormat="Json" >
          <readerQuotas  maxStringContentLength="8192000" />
        </standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>
相关文章
相关标签/搜索