我将MaxReceivedMessageSize增加到2147483647,但我仍然遇到此错误。我在服务器配置和客户端配置上添加了相同的值。请helpppp
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.
答案 0 :(得分:4)
如果您在配置文件的<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>
显然,这不是一个完整的配置文件,它只是对<endpoint>
bindingConfiguration属性和<binding>
name属性之间关系的直观演示。如果不设置此值,WCF将为您提供默认值的绑定。