WPF或Winform在“添加服务引用”,调用服务时报错:System.ServiceModel.CommunicationException:“已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性。”,或者英文:The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize attribute on the corresponding binding element. "。如下图:


这个问题一般是自处理数据量大时才出现。这里报错已经提示了“maxReceivedMessageSize”也就是“最大接收消息大小”属性的设置,打开工程项目里的“App.config”文件,设置<system.serviceModel> <bindings> <basicHttpBinding> 对应的节点属性,在binding节点修改“maxBufferPoolSize”和“maxReceivedMessageSize”值(加大参数设置,分别为“最大缓冲池大小”和“最大接收消息大小”)。如下图: