【问题标题】:The maximum message size quota for incoming messages (65536) has been exceeded WCF已超出传入邮件 (65536) 的最大邮件大小配额 WCF
【发布时间】:2015-06-13 03:52:30
【问题描述】:
    <?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name ="SaadiqinWcf.SaadiqinServiceBehavior">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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"/>
          <dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name ="jsonBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <services>
      <service name="SaadiqinWcf.SaadiqinService" behaviorConfiguration="SaadiqinWcf.SaadiqinServiceBehavior">
        <endpoint name ="SaadiqinEndPoint" address="**" binding="basicHttpBinding" bindingConfiguration="myBindingConfiguration" contract="**"  />
        <!-- <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>--> 
      </service>
    </services>

    <bindings>
      <basicHttpBinding>
        <binding name="myBindingConfiguration" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00">
          <readerQuotas maxDepth="128" maxStringContentLength="8388608"
            maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding> 
    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <httpProtocol>
      <customHeaders>
        <add name ="Access-Control-Allow-Origin" value ="*"/>
      </customHeaders>
    </httpProtocol>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <connectionStrings>
    <add name="SaadiqinEntities" connectionString="data source=*****,***;initial catalog=***;persist security info=true;user id=***; Password=***; TrustServerCertificate=True; multipleactiveresultsets=True;application name=EntityFramework" />
  </connectionStrings>    
</configuration>

这是我的Web.config 文件。运行测试客户端时出现 WCF 错误。我也添加了绑定配置,但它仍然抛出同样的错误(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.)

我已经将我的web.config 中的MaxReceivedMessageSize 属性设置为一个很大的值,我还使用上述配置在客户端本身的代码以及服务中设置了绑定但没有更改。

绑定是否正确?我需要添加其他内容还是需要删除某些内容。我很困惑。

注意:我正在从 WCF 测试客户端测试服务。

【问题讨论】:

    标签: .net wcf configuration web-config


    【解决方案1】:

    我找到了答案。 实际上 WCF 测试客户端有自己的配置。我更改了配置文件。现在工作就像一个魅力。 :)

    谢谢

    【讨论】:

    • 您能告诉我,您是如何更改该配置的吗?
    • 1.运行测试客户端 2. 一直到您的服务。有web.config。 3.右键单击并单击EditWithSvcConfigEditor更改您想要更改的任何内容。
    猜你喜欢
    • 2018-01-15
    • 2015-09-15
    • 2012-03-13
    • 2014-02-13
    • 2011-02-23
    相关资源
    最近更新 更多