有关最大接收消息大小的 WCF 错误
本文关键字:WCF 错误 消息 | 更新日期: 2023-09-27 18:34:48
我已经研究这个错误一段时间了,我觉得这个问题一直在被问到......但我似乎找不到问题所在。
我收到正常的MaxReceivedMessageSize
错误:
The maximum message size quota for incoming messages (65536) has been exceeded.
我的服务配置中是否缺少某些内容?
<system.serviceModel>
<services>
<service name="LifeEApplication.Services.RateService.RateServiceHost" behaviorConfiguration="RateService.RateServiceHostBehavior">
<endpoint address="" binding="basicHttpBinding" contract="LifeEApplication.Services.Contracts.RateServiceContract.IRateService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RateService.RateServiceHostBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:02:00"
sendTimeout="00:02:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Certificate" algorithmSuite="Default"/>
</security>
</binding>
<binding name="LocalBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:02:00"
sendTimeout="00:02:00">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://integrationmdl.grangeinsurance.com/lifequote/LoggingServiceHost/DotNetLoggingServiceHost.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicBinding"
name="BasicBinding"
contract="LifeEApplication.Services.Contracts.LoggingServiceContract.IDotNetLoggingService"/>
<endpoint address="https://integrationmdl.grangeinsurance.com/lifequote/OracleTrimarkServiceHost/OracleTrimarkServiceHost.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicBinding"
name="BasicBinding"
contract="LifeEApplication.Services.Contracts.OracleServiceContract.IOracleService"/>
</client>
我的函数在少量数据下工作正常,所以我知道这是MaxReceivedMessageSize
大小的问题。 我尝试的所有方法都会导致相同的问题。
值得注意的是:当我使用 WCF Test Client
调试服务时,显示的配置文件没有我在其配置中指定的最大大小。
听起来客户端配置需要增加消息大小。右键单击配置文件,选择"编辑 WCF 配置",然后更改 MaxReceivedMessageSize 值。
我同意eschneider的观点。您需要更改客户端(RateService项目(主Web.config文件下的设置。右键单击它,然后选择"编辑 WCF 配置"。在"配置"面板下的弹出窗口中,选择"绑定">">您的定义绑定"(例如 wsHttpBinding(。然后将 MaxReceivedMessageSize 更改为 2147483647。我希望这能帮助你。