3

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

Community
  • 1
  • 1
ercan
  • 825
  • 3
  • 16
  • 27
  • Could be related to this: http://stackoverflow.com/questions/884235/wcf-how-to-increase-message-size-quota increase the message size the server allows you to transmit. – JensB Jun 03 '14 at 07:49
  • i set maxReceivedMessageSize to 2147483647 but still same error – ercan Jun 03 '14 at 07:57
  • http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize – Pranav Singh Jun 03 '14 at 09:03
  • http://stackoverflow.com/questions/23513785/calling-wcf-service-from-excel-gives-error-on-received-message-size/23514486#23514486 – Pranav Singh Jun 03 '14 at 09:16

1 Answers1

1

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>
Tim
  • 28,212
  • 8
  • 63
  • 76