WCF中的请求实体过大错误(413)
本文关键字:大错误 实体 请求 WCF | 更新日期: 2024-09-22 00:34:02
即使maxReceivedMessageSize设置为最大值,即2147483647,并且实际消息大小小于50kb,我在WCF服务中也面临413错误。
只有当两个请求之间存在理想的时间时,才会出现此问题。具体情况如下:1.发送1000条消息,每条消息的大小约为38kb。状态:通过2.等待一段时间(至少3分钟)3.发送1条消息。状态:失败。(413错误)
我正在使用ws2007FederationHttpBinding。Web.config标签如下:
<ws2007FederationHttpBinding>
<binding name="federationHttpBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647">
<!-- <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> -->
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false">
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
客户端绑定标签如下:
<ws2007FederationHttpBinding>
<binding name="AuthorizationBinding" openTimeout="00:04:00" closeTimeout="00:04:00" receiveTimeout="00:04:00" sendTimeout="00:40:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false"/>
</security>
</binding>
</ws2007FederationHttpBinding>
我认为你可以通过从绑定标签中删除name属性来解决这个问题,也可以在这里找到类似的问题
WCF服务maxReceivedMessageSize basicHttpBinding问题
您还必须设置maxBufferSize
<binding name="federationHttpBinding"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647">