我有一个WCF服务的以下配置。
尽管我已经增加了maxReceivedMessageSize,服务仍引发一个错误:
的最大邮件大小配额传入消息(65536)已被超过。为了增加配额,使用MaxReceivedMessageSize财产上的适当结合element.`异常。
这又如何解决呢?
< system.serviceModel>
<服务>
<服务名称=为MyServicebehaviorConfiguration =MyServiceTypeBehaviors>
<端点地址=HTTP://本地主机:22230 / MyService.svc
绑定=basicHttpBinding的
bindingConfiguration =MyServiceBinding
合同=IMyService/>
<终点合同=IMetadataExchange接口绑定=mexHttpBinding地址=MEX/>
< /服务>
< /服务>
<行为>
< serviceBehaviors>
<行为NAME =MyServiceTypeBehaviors>
< serviceMetadata httpGetEnabled =真/>
< /行为>
< / serviceBehaviors>
< /行为>
<绑定>
< basicHttpBinding的>
<绑定名称=MyServiceBinding
hostNameComparisonMode =StrongWildcard
receiveTimeout =00:10:00
的SendTimeout =00:10:00
openTimeout =00:10:00
closeTimeout =00:10:00
maxReceivedMessageSize =6553600
maxBufferSize =6553600
maxBufferPoolSize =524288
transferMode =缓冲
messageEncoding =文本
textEncoding =UTF-8
bypassProxyOnLocal =假
useDefaultWebProxy =真正的>
<安全模式=无/>
< /装订>
< / basicHttpBinding的>
< /绑定>
< /system.serviceModel
解决方案
如果是这种服务的配置,你应该看看你的客户端配置,并符合maxReceivedMessageSize到服务器的邮件大小。该消息是从客户端来了。
I have the following configuration for a WCF service.
Even though I have increased the maxReceivedMessageSize , service still throws an 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.`" exception.
How can this be solved?
<system.serviceModel>
<services>
<service name="MyService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="http://localhost:22230/MyService.svc"
binding="basicHttpBinding"
bindingConfiguration="MyServiceBinding"
contract="IMyService" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="MyServiceBinding"
hostNameComparisonMode="StrongWildcard"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00"
maxReceivedMessageSize="6553600"
maxBufferSize="6553600"
maxBufferPoolSize="524288"
transferMode="Buffered"
messageEncoding="Text"
textEncoding="utf-8"
bypassProxyOnLocal="false"
useDefaultWebProxy="true" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel
解决方案
If this is the service config, you should look in your client config and match the maxReceivedMessageSize to the servers message size. The message is coming from your client.