我有一个返回1000条记录的WCF服务,从数据库中向客户端返回数据。我有一个ASP.NET WCF客户端(我已经在ASP.NET Web应用程序项目中添加了服务引用以使用WCF)。
当我运行客户端应用程序时,会收到以下消息:
传入消息的最大消息大小配额(65536)已超过。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
如何增加消息大小配额?需要什么帮助吗?
我有一个返回1000条记录的WCF服务,从数据库中向客户端返回数据。我有一个ASP.NET WCF客户端(我已经在ASP.NET Web应用程序项目中添加了服务引用以使用WCF)。
当我运行客户端应用程序时,会收到以下消息:
传入消息的最大消息大小配额(65536)已超过。要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性。
如何增加消息大小配额?需要什么帮助吗?
对于我来说,我所需要做的就是在客户端app.config中添加maxReceivedMessageSize="2147483647"
。而服务器方面则没有更改。
请注意,执行入口的app.config将被考虑,而不是类库项目管理Web服务调用的配置文件(如果有)。
例如,如果在运行单元测试时出现错误,则需要在测试项目中设置适当的配置文件。
当我在web.config中使用这些设置时,我遇到了这个错误
System.ServiceModel.ServiceActivationException
<service name="idst.Controllers.wcf.Service_Talks">
<endpoint address="" behaviorConfiguration="idst.Controllers.wcf.Service_TalksAspNetAjaxBehavior"
binding="webHttpBinding" contract="idst.Controllers.wcf.Service_Talks" />
</service>
<service name="idst.Controllers.wcf.Service_Project">
<endpoint address="" behaviorConfiguration="idst.Controllers.wcf.Service_ProjectAspNetAjaxBehavior"
binding="basicHttpBinding" bindingConfiguration="" bindingName="largBasicHttp"
contract="idst.Controllers.wcf.Service_Project" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="largBasicHttp" allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>