WCF请求实体太大让我疯狂

时间:2016-12-02 14:31:38

标签: wcf config

我的配置文件在这里。

看着其他问题尝试了一切,但......

为什么我无法设置maxRequestSize等。这不起作用。

它给出了一个错误,即“请求实体太大"

有人可以帮助我吗?

<?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>
    <services>
      <service name="RST_SSDOP_TO_LOGO.Service.Server">
        <endpoint name="EndPoint1" binding="basicHttpBinding" bindingConfiguration="qwerty" contract="RST_SSDOP_TO_LOGO.Service.IServer"></endpoint>
      </service>
    </services>
    <client>
      <endpoint address="http://192.168.1.249:52215/Server.svc" binding="basicHttpBinding"
        bindingConfiguration="qwerty" contract="RST_SSDOP_TO_LOGO.Service.IServer"
        name="EndPoint1" kind="" endpointConfiguration="" />
    </client>
    <bindings>
      <basicHttpBinding>
        <binding name="qwerty" closeTimeout="01:00:00" maxBufferPoolSize="2147483647"
          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

1 个答案:

答案 0 :(得分:0)

我猜您在客户端收到此错误。 记住你必须在客户端设置最大尺寸!!!

<binding name="SoapBinding" maxReceivedMessageSize="2000000" />