WCF: The remote server returned an error: (413) Request Entity Too Large

17,042

You don't assign a defined WebHttpBinding configuration to your endpoint, so the endpoint uses the default values for the binding.

You can tell the endpoint to use your binding congfiguration by specifying it in the bindingConfiguration attribute on the <endpoint> element, like this:

<endpoint address="" binding="webHttpBinding"
          bindingConfiguration="webHttpTransportSecurity"
          contract="FieldHoundServices.IFHSmartService" 
          behaviorConfiguration="web">
</endpoint>
Share:
17,042
ercan
Author by

ercan

Updated on June 05, 2022

Comments

  • ercan
    ercan almost 2 years

    I have a wcf service

    there is a method which gets base64 string to upload a file my file's size 100kb it may be larger in time

    i got the error message: The remote server returned an error: (413) Request Entity Too Large while try to get HttpWebResponse

    this is my wcf service web.config

    <system.serviceModel>
    <bindings>
      
      <webHttpBinding>
        
        <binding name="webHttpTransportSecurity" allowCookies="false" maxReceivedMessageSize="104857600">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
           maxBytesPerRead="2147483647" />
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="FHServices.FHSmartService" behaviorConfiguration="ServiceBehaviour">
        
        <endpoint address="" binding="webHttpBinding" contract="FieldHoundServices.IFHSmartService" behaviorConfiguration="web">
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost/FHServices/FHSmartService.svc/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    

    what is my mistake?


    solved

    i found my mistake i remove these codes

    <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
    

    i think transport mode for https and we have no ssl so we dont need transport mode. anyway after i remove it, everything seems ok now

  • Naveenkumar
    Naveenkumar almost 10 years
    Thanks and great ans....