增加 wcf 的响应大小 [英] increase response size of wcf

查看:15
本文介绍了增加 wcf 的响应大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

wcf 无法检索超过 100 行的数据集.它显示消息已超出传入消息的最大消息大小配额 (65536).要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性."但是在 wcf 项目的 web.config 中,我进行了绑定,如下所示

wcf fails to retrieve dataset with more than 100 rows. it shows message "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." but inside web.config for wcf project i had made binding as shown below

<bindings>
  <basicHttpBinding>
    <binding name="basicHttp" allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint binding="basicHttpBinding" bindingConfiguration="wsHttpBinding_ILabelService" contract="LabelService.ILabelService" name="BasicHttpBinding_ILabelService"/>
</client>

<services>
  <service name="projectname.Service1"   behaviorConfiguration="projectname.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="wsHttpBinding"  contract="projectname.IService1">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding"   contract="IMetadataExchange"/>
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="projectname.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>          
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true"/>

    </behavior>
  </serviceBehaviors>
</behaviors>


请帮忙.

推荐答案

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_ILabelService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="3145728" maxBufferPoolSize="524288" maxReceivedMessageSize="3145728" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="3145728" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILabelService" contract="LabelService.ILabelService" name="BasicHttpBinding_ILabelService"/>
    </client>
</system.serviceModel>

编辑

您必须将端点设置为绑定名称.在你的配置中试试这个.注意:您必须将 contract 设置为具有完整命名空间结构的服务类名称,并将bindingConfiguration 设置为您的绑定配置name.

You must set your endpoint to binding name. Try this in your config. Notice: You must set contract to your service class name with full namespace structure and bindingConfiguration to your binding counfiguration name.

<client>
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="YourNamespace.YourServiceClassName" name="BasicHttpBinding_ILabelService"/>
</client>

这篇关于增加 wcf 的响应大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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