Wcf服务错误最大邮件大小配额

时间:2015-02-03 09:56:55

标签: wcf maxreceivedmessagesize

当我正在尝试从控制台应用程序调用web服务时,我仍然会收到此错误。谢谢你的任何想法。

这是我的错误详情 已超出传入邮件的最大邮件大小限额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性。

这是我的web.config文件

    <?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="bBinding"  receiveTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" allowCookies="true" maxReceivedMessageSize="2147483647"  maxBufferPoolSize="2147483647">

          <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"  maxNameTableCharCount="2147483647"  maxBytesPerRead="2147483647"/>
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" />
          </security>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="wBinding" maxReceivedMessageSize="20000000"
                 maxBufferSize="20000000"
                 maxBufferPoolSize="20000000">
          <readerQuotas maxDepth="32"
              maxArrayLength="200000000"
              maxStringContentLength="200000000"/>
          <!--https geldiği zaman, mod transport olmalı-->
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="srvBehavior">
          <!--https geldiği zaman httpsGetEnabled true olmalı-->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="ServiceAspNetAjaxBehavior">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
    <services>
      <service behaviorConfiguration="srvBehavior" name="FordDersService.FordDers">
        <endpoint address="soap" binding="basicHttpBinding" bindingConfiguration="bBinding" contract="FordDersService.IFordDers"/>
        <endpoint address="rest" binding="webHttpBinding" bindingConfiguration="wBinding" contract="FordDersService.IFordDers"  behaviorConfiguration="ServiceAspNetAjaxBehavior"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:0)

<bindings>
    <basicHttpBinding>


          <binding name="basicHttp" allowCookies="true"
                     maxReceivedMessageSize="20000000" 
                     maxBufferSize="20000000"
                     maxBufferPoolSize="20000000">
                <readerQuotas maxDepth="32" 
                     maxArrayLength="200000000"
                     maxStringContentLength="200000000"/>
            </binding>
        </basicHttpBinding>
    </bindings>