gpt4 book ai didi

wcf - 已超出传入消息的最大消息大小配额(明显修复无济于事)

转载 作者:行者123 更新时间:2023-12-04 15:03:52 24 4
gpt4 key购买 nike

我有一个使用 WCF 和 netTcpBinding 上传大文件的应用程序。对于特定文件,我收到错误消息:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.



这是我对客户端 web.config 文件的绑定(bind)(客户端是 ASP.NET 网站):
    <binding name="DataImportEndpoint" closeTimeout="00:20:00" openTimeout="00:01:00"
receiveTimeout="00:20:00" sendTimeout="00:20:00" transferMode="Buffered"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
</security>
</binding>

我意识到我还需要更改服务配置的 maxReceivedMessageSize 属性。所以我添加了这个绑定(bind):
<bindings>
<netTcpBinding>
<binding name="NetTcpLarge"
maxReceivedMessageSize="5242880" maxBufferSize="5242880">
<readerQuotas maxStringContentLength="524288"/>
</binding>
</netTcpBinding>
</bindings>

并修改了我的端点:
<endpoint address="DataImportService" binding="netTcpBinding"
name="DataImportEndpoint" bindingConfiguration="NetTcpLarge"
contract="IDataImportService" />

这解决了我在 Visual Studio 中运行自托管时的问题。但在 IIS 7 上运行的实例上,我是 还是 得到与已超过 65536 相同的错误。我在这里错过了什么吗?我什至将此添加到我在 IIS 7 实例中的服务配置中,但无济于事:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="5242880" />
</requestFiltering>
</security>
</system.webServer>

最佳答案

如果 IIS 的异常仍然相同,则与 <requestLimits> 无关。 , 异常清楚地表明 maxReceivedMessageSize超过。我会在详细级别捕获 WCF 跟踪并检查在端点上应用了哪些绑定(bind)配置。

我建议您重新检查客户端和服务配置,如果仍然没有线索,请在详细级别捕获服务和客户端的跟踪。

关于wcf - 已超出传入消息的最大消息大小配额(明显修复无济于事),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5608017/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com