【问题标题】:increase message size quota增加消息大小配额
【发布时间】:2015-02-03 08:23:13
【问题描述】:

我在运行应用程序时收到以下消息: 已超出传入邮件 (65536) 的最大邮件大小配额。要增加配额,请在适当的绑定元素上使用 MaxReceivedMessageSize 属性。

<configuration>
<connectionStrings>
    <add name="abc" connectionString="Data Source=xyz;Initial Catalog=abc;Persist Security Info=True;User ID=abc;Password=abc"/>
  </connectionStrings>
<system.web>
<compilation debug="true"/>
    <globalization uiCulture="en-GB" culture="en-GB"/>
 <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
 <bindings>
 <basicHttpBinding>
<binding name="PictureBinding" maxReceivedMessageSize="2000000" maxBufferSize="2000000">
<readerQuotas
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
 maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
 </binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WCFservice.Service1Behavior">
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
 <serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="WCFservice.Service1Behavior" name="WCFservice.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="PictureBinding" contract="WCFservice.IService1">
</endpoint>
 <endpoint address="web" binding="webHttpBinding" contract="WCFservice.IService1">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
 </service>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

【问题讨论】:

    标签: c# .net wcf configuration


    【解决方案1】:

    你可以使用这个配置

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

    你也可以务实地做到这一点

    BasicHttpBinding httpBinding = new BasicHttpBinding();
    httpBinding.MaxReceivedMessageSize = 2147483647;
    httpBinding.MaxBufferSize = 2147483647;
    

    【讨论】:

      猜你喜欢
      • 2020-10-06
      • 2012-01-13
      • 2010-12-15
      • 1970-01-01
      • 2014-06-24
      • 1970-01-01
      • 2018-07-29
      • 2015-04-02
      • 2013-11-03
      相关资源
      最近更新 更多