我是 WCF 的新手,我正试图了解服务所采用的迷宫般的配置。我有一个休息服务可以返回一个表的导出,它比默认值大 maxReceivedMessageSize
。所以我一直在尝试使用此服务/端点的配置,但我无处可去。下面如果我正在研究的要点,我错过了什么?我只是将 List 作为 JSON 或 XML 返回,并且我需要能够返回超过默认阈值。
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<!-- defin service -->
<service behaviorConfiguration="EPRestBehavior" name="EPRestDNS">
<endpoint address=""
bindingConfiguration="ApiExportBinding"
binding="webHttpBinding"
contract="IDNSRestService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EPRestBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
...
</behaviors>
<bindings>
<!-- Customizations for REST service -->
<webHttpBinding>
<binding name="ApiExportBinding" maxReceivedMessageSize="10485760"
maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
<readerQuotas maxDepth="32" maxStringContentLength="10485760"
maxArrayLength="10485760" maxBytesPerRead="10485760" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
更新 1 我已经删除了所有这些配置,并尝试使用现有的 webHttpEndpoint 部分进行更简单的操作:
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="1000000000" />
</webHttpEndpoint>
</standardEndpoints>
结果相同。 HTTP/1.1 502 Connection reset by peer