WCF REST获取响应504 json数据太大

时间:2012-05-07 12:54:59

标签: c# wcf rest

我一直在构建基于WCF REST模板的REST服务,您可以使用Visual Studio 2010将其作为模板下载。(带有密钥授权的REST入门套件)我的web.config看起来像这样。

  <system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceAuthorization serviceAuthorizationManagerType="APIKeyAuthorization, SSD.Harrier.Services.REST" />
    </behavior>


  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="false" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" defaultOutgoingResponseFormat="Json" />
  </webHttpEndpoint>
</standardEndpoints>

当我尝试恢复超过3000条记录的记录时,我在fiddler中收到504错误,它无法处理响应。我甚至尝试对同一服务进行POST。有没有办法在web.config中配置此端点以允许更大的响应?我现在正在做的事情不起作用。谢谢你的帮助!

1 个答案:

答案 0 :(得分:3)

尝试

<configuration> 
<system.web.extensions>
   <scripting>
       <webServices>
           <jsonSerialization maxJsonLength="50000000"/>
       </webServices>
   </scripting>
</system.web.extensions>
</configuration>