【问题标题】:Maximum Message Size quota for Incoming messages has been exceeded exception已超出传入邮件的最大邮件大小配额异常
【发布时间】:2011-11-12 11:32:11
【问题描述】:

我将 MaxReceivedMessageSize 增加到 2147483647,但我仍然收到此错误。我在服务器配置和客户端配置上设置了相同的值。请帮助ppp

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.

Server stack trace: 
   at System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()
   at System.ServiceModel.Channels.HttpInput.GetMessageBuffer()
   at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
   at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IService1.GetRecordsforMAR(Int32 showDeleted)
   at Service1Client.GetRecordsforMAR(Int32 showDeleted)

Inner Exception:
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.

【问题讨论】:

  • 由于您仍然遇到下限错误,因此您没有在正确的位置更改值:“...在适当的绑定元素上。”
  • 我更改了客户端和服务器配置文件的值。我不确定我还需要在哪里更改它。我是 WCF 新手,请帮忙
  • 如果您需要更多帮助,您必须发布 xml。

标签: wcf


【解决方案1】:

如果您在配置文件的 <binding> 部分设置了值,则需要确保在 <endpoint> 元素的 bindingConfiguration 属性中引用这些绑定:

即:

<bindings>
    <wsHttpBinding>
        <binding name="MyWsHttpBinding" /> 
        <!-- Other values for this binding ommitted for purposes of demonstration -->
    </wsHttpBinding>
</bindings>

<services>
    <service name=MyService">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MyWsHttpBinding" contract="IMyContract" />
    <service>
</services>

显然这不是一个完整的配置文件,它只是&lt;endpoint&gt; bindingConfiguration 属性和&lt;binding&gt; name 属性之间关系的可视化演示。如果你不设置这个,WCF 会给你一个默认值的绑定。

【讨论】:

  • 谢谢您,只是想补充一点,这些更改应该同时应用于服务器和客户端以使其正常工作(这些设置是 maxBufferPoolSize 和 maxReceivedMessageSize。)
猜你喜欢
  • 2012-03-13
  • 2012-05-14
  • 2011-02-23
  • 2010-11-11
  • 1970-01-01
相关资源
最近更新 更多