错误:已超出传入邮件的最大邮件大小配额 (65536) [英] Error: the maximum message size quota for incoming messages (65536) has been exceeded

查看:27
本文介绍了错误:已超出传入邮件的最大邮件大小配额 (65536)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误消息

已超出传入邮件的最大邮件大小配额 (65536)

The maximum message size quota for incoming messages (65536) has been exceeded

当我尝试将文件(+-160KB)上传到我的 WCF 服务时.我试图增加以下属性的值:

when I try to upload files(+-160KB) to my WCF service. I've tried to increase the values of the following attributes :

maxReceivedMessageSize,
maxBufferPoolSize,
maxArrayLength,
maxStringContentLength, 

但我没有运气.我的 WCF 配置文件如下所示:

but I had no luck. My WCF config file looks like this :

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsBinding" maxReceivedMessageSize="3200000" maxBufferPoolSize="100000000"  >
          <readerQuotas maxArrayLength="1000000000" maxStringContentLength="3200000" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client />
    <services>
      <service behaviorConfiguration="PMSService.Thomolosha"
        name="PMSService.Thomolosha" >
        <endpoint address="" binding="wsHttpBinding"  contract="PMSService.ThomoloshaDeclaration">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"  contract="IMetadataExchange" />
      </service>
      <service behaviorConfiguration="PMSService.Arekwe"
              name="PMSService.Arekwe">
        <endpoint address="" binding="wsHttpBinding" contract="PMSService.ArekweDeclaration">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="PMSService.Thomolosha">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
        <behavior name="PMSService.Arekwe">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

我的 Winform 配置如下所示:

My Winform config looks like this :

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_ThomoloshaDeclaration" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="100000000" maxReceivedMessageSize="3200000" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="3200000" maxArrayLength="1000000000"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
              algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="WSHttpBinding_ArekweDeclaration" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="100000000" maxReceivedMessageSize="3200000" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="3200000" maxArrayLength="1000000000"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
              algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:57388/Thomolosha.svc" binding="wsHttpBinding"
        bindingConfiguration="WSHttpBinding_ThomoloshaDeclaration" contract="Thomolosha.ThomoloshaDeclaration"
        name="WSHttpBinding_ThomoloshaDeclaration">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="http://localhost:57388/Arekwe.svc" binding="wsHttpBinding"
        bindingConfiguration="WSHttpBinding_ArekweDeclaration" contract="Arekwe.ArekweDeclaration"
        name="WSHttpBinding_ArekweDeclaration">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

推荐答案

听起来您在服务端遇到了错误(当您尝试上传时).根据您发布的服务配置,您已为 maxReceivedMessageSize 和其他设置设置了更高的限制,但您从未将该绑定分配到您的服务端点,因此 WCF正在使用 maxReceivedMessageSize 的默认值 (65536).

It sounds like you're getting the error on the service side (when you try to upload). According to your posted service config, you've set a higher limit for maxReceivedMessageSize and other settings, but you never assign that binding to your service endpoint(s), so WCF is using the default value for maxReceivedMessageSize (65536).

您需要通过 endpoint 元素的 bindingConfiguration 属性将定义的绑定 (wsBinding) 分配给您的服务端点,像这样:

You need to assign your defined binding (wsBinding) to your service endpoint(s) via the bindingConfiguration attribute of the endpoint element, like this:

<endpoint address="" 
          binding="wsHttpBinding"
          bindingCongifuration="wsBinding"
          contract="PMSService.ThomoloshaDeclaration">

现在该服务将使用您定义的绑定配置,该配置具有更大的尺寸.

Now the service will use the binding configuration you've defined, that has the larger size.

这篇关于错误:已超出传入邮件的最大邮件大小配额 (65536)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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