WCF MaxReceivedMessageSize错误

WCF MaxReceivedMessageSize错误,wcf,maxreceivedmessagesize,Wcf,Maxreceivedmessagesize,我在调用wcf服务(wshttpbinding)时遇到以下错误。我已经将MaxReceivedMessageSize设置为最大值(2147483647)。谁能告诉我怎么了 我使用的是“安全模式=“消息”,这有问题吗 错误: 已超过传入邮件的最大邮件大小配额(65536)。要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性 配置:(客户端) 服务器配置: <system.serviceModel> <services>

我在调用wcf服务(wshttpbinding)时遇到以下错误。我已经将MaxReceivedMessageSize设置为最大值(2147483647)。谁能告诉我怎么了

我使用的是“安全模式=“消息”,这有问题吗

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

配置:(客户端)


服务器配置:

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="LargeWS" name="GexaEnrollCustomer.GexaEnroll">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureBinding"
          name="wsDemo" contract="MyInterfaces.IProducts">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" name="wsMex"
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://demo.com/DemoServices/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="LargeWS">
          <serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="200" maxConcurrentSessions="200" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="SecureBinding" maxBufferPoolSize="2147483647" closeTimeout="00:15:00" openTimeout="00:15:00"
          receiveTimeout="00:15:00" sendTimeout="00:15:00" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Message">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />

  </system.serviceModel>

请注意,错误消息的状态是“针对传入消息”,这使我相信引发此错误的是服务器端,而不是客户端。除了客户端之外,您可能还需要在服务器上设置
MaxReceivedMessageSize


通常,您会将客户端和服务器的配置设置为相同的大小。

您还需要更改maxBufferSize。

是。我做到了。这里是服务器配置。看我的第一条留言。
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="LargeWS" name="GexaEnrollCustomer.GexaEnroll">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureBinding"
          name="wsDemo" contract="MyInterfaces.IProducts">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" name="wsMex"
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://demo.com/DemoServices/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="LargeWS">
          <serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="200" maxConcurrentSessions="200" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="SecureBinding" maxBufferPoolSize="2147483647" closeTimeout="00:15:00" openTimeout="00:15:00"
          receiveTimeout="00:15:00" sendTimeout="00:15:00" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Message">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />

  </system.serviceModel>