WCF:如何设置MaxReceivedMessageSize配额 [英] WCF : How to Set MaxReceivedMessageSize Quota

查看:697
本文介绍了WCF:如何设置MaxReceivedMessageSize配额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务。我收到以下消息当我运行客户端应用程序

I have a WCF Service. I get the following message when I run the client application

的最大邮件大小配额传入消息(65536)已   超标。为了增加配额,使用MaxReceivedMessageSize   财产适当的绑定元素。

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.

此外,我加入MaxReceivedMessageSize财产相关的配置在客户端和服务器项目。

Also i added MaxReceivedMessageSize property in related config in client and server projects.

我的客户端应用程序配置为:

My config in client application is :

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="RPBasicHttpBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
          <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:40003/PersonWcfService.svc/PersonServices"
        binding="basicHttpBinding"
        contract="RP.Common.ServiceContract.IPersonService" name="BasicHttpBinding_IPersonService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

我在WCF项目配置为:

My config in WCF project is :

<system.serviceModel>
    <services>
      <service name="RP.WcfService.PersonWcfService" behaviorConfiguration="RP.WcfServiceBehaviour">
        <endpoint address="PersonServices" binding="basicHttpBinding" bindingConfiguration="RPBasicHttpEndpointBinding" contract="RP.Common.ServiceContract.IPersonService" />
      </service>
    </services>
    <behaviors>
    <serviceBehaviors>
      <behavior name="RP.WcfServiceBehaviour">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="RPBasicHttpEndpointBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000" maxBufferPoolSize="20000000">
          <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

当其他的话,我应该设置MaxReceivedMessageSize属性增加邮件大小配额?

Where other is then i should set MaxReceivedMessageSize property to increase message size quota?

推荐答案

你是不是在客户端的端点配置中缺少 bindingConfiguration =RPBasicHttpBinding .. ,从而让您的指定配置的basicHttpBinding的的默认配置呢?

Aren't you missing bindingConfiguration="RPBasicHttpBinding" in your endpoint configuration on the client side... and thus getting a default configuration of the basicHttpBinding instead of your specified configuration?

这篇关于WCF:如何设置MaxReceivedMessageSize配额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆