简体   繁体   English

WCF最大邮件大小错误

[英]WCF Max Message Size Error

I have implemented WCF services for IStudent and few of them throwing Max Message size quota for incoming messages (65536) has been exceeded. 我已经为IStudent实现了WCF服务,并且其中很少有人为传入消息抛出最大消息大小配额(65536)。 I have implemented wsHttpBinding, also I tried to increase message side under bindings tab but still getting error, also binding maxBufferSize=""... not recognized if it suppose to be 我已经实现了wsHttpBinding,我也尝试增加“绑定”选项卡下的消息面,但仍然出现错误,还绑定了maxBufferSize =“” ...如果认为是,则无法识别

Initially I am testing my service on WCF Test Client Tool 最初,我在WCF测试客户端工具上测试我的服务

App.config App.config

<service name="App.WebServices.Manager.EBSMiddlewareServicesManager" behaviorConfiguration="EBSMiddlewareBehaviorDefault">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:30432/"/>
      </baseAddresses>
    </host>
    <endpoint name="StudentServices" address="StudentServices" binding="wsHttpBinding" contract="App.WebServices.ServiceContract.IStudentServices"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
</services>

.... ....

<bindings>
  <wsHttpBinding>
    <binding name="DefaultTransportSecurity" sendTimeout="00:10:00" allowCookies="true" maxReceivedMessageSize="2147483647" maxBufferSize="" maxBufferPoolSize="2147483647">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </wsHttpBinding>
</bindings>

Error 错误

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(HttpRequestMessage httpRequestMessage, Exception& requestException)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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 IStudentServices.GetActiveStudentList()
at StudentServicesClient.GetActiveStudentList()

  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.

The MaxReceivedMessageSize property of the of the binding is what is being exceeded in the error below. 绑定的MaxReceivedMessageSize属性是以下错误所超出的范围。 You need to override that value. 您需要覆盖该值。 You may also want to test the values you have applied to the readerQuotas. 您可能还需要测试已应用于readerQuotas的值。

<wsHttpBinding>
    <binding 
         name="myBinding" 
         maxReceivedMessageSize="2147483647"
     </binding>
</wsHttpBinding>

I have found reason, the app.config I have updated is for server side and I am using WCF Test Client tool to test my services so I need to increase the size at tool side too 我已经找到原因,我更新的app.config是针对服务器端的,并且我正在使用WCF测试客户端工具来测试我的服务,因此我也需要在工具端增加大小

add service, notice there is a "config file" node at the end of the service tree: right click it and select "edit with SvcConfigEditor", get the exact configuration editor for the service side - just go to the binding settings and change the MaxReceivedMessageSize and save the changes. 添加服务,请注意在服务树的末尾有一个“配置文件”节点:右键单击它并选择“使用SvcConfigEditor编辑”,获取服务端的确切配置编辑器-只需转到绑定设置并更改MaxReceivedMessageSize并保存更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM