The maximum message size quota for incoming messages (65536) has been exceeded.

[已解决] The maximum message size quota for incoming messages (65536) has been exceeded.

10
[软件及编程 > WCF]
System.ServiceModel.CommunicationException:

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.

使用Silverlight和WCF交互的时候,出现了这个问题,看似是超出了65536这个限制,请问在哪里设置呢?
提问时间:2010/8/24 17:10:53 | 提问者:GaLiJiKuai | 悬赏:10 | 浏览:2892
最佳答案
需要在Web.config中的<system.serviceModel>/<bindings>节点中添加设置:

<system.serviceModel>
<bindings>
   <basicHttpBinding>
       <binding name="basicHttp" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
           <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
       </binding>
   </basicHttpBinding>
</bindings>
</system.serviceModel>

然后在web.config中的endpoint属性中加入对应的bindingConfiguration="basicHttp",如:
<service name="Web.Services.QuestionService">
   <endpoint bindingConfiguration="basicHttp" address="" binding="basicHttpBinding" contract="Web.Services.IQuestionService" />
</service>


同时,最好在你的客户端App.config或者ServiceReferences.ClientConfig中的system.serviceModel节点也设置一下maxReceivedMessageSize的值。

maxReceivedMessageSize的值默认为65536

===================
此回答修改于:2010-8-24 17:40:05
回答时间:2010/8/24 17:40:05 | 回答者:Souidea
其他参考答案(0)
提交失败!请检查错误!错误信息:

注:以上所有信息由网友提供,仅供交流、参考,均不代表盛派网络言论,如果有任何问题或不妥,请立即联系我们

以下信息或许对您有用: