Click here to Skip to main content
15,893,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting this error while sending files data as base64 string through headers

HTTP Error 400. The size of the request headers is too long.

even I have done some settings in the web.config for receiving large data as follows:

C#
<system.servicemodel>
        <bindings>
            <webhttpbinding>
                <binding name="SecureBinding" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" transfermode="Buffered">
                    <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" />
                    <security mode="Transport">
                        <transport>
                            <extendedprotectionpolicy policyenforcement="Never" />
                        </transport>
                    </security>
                </binding>
            </webhttpbinding>
        </bindings>

        <services>
            <service behaviorconfiguration="WCFService.Service1Behavior">
              name="TokenService.Service">

                <endpoint>
                  address=""
                  binding="webHttpBinding"
                  bindingConfiguration="SecureBinding"
                  contract="TokenService.IService" behaviorConfiguration="webEndPoint">
                </endpoint>

            </service>
        </services>


        <behaviors>
            <endpointbehaviors>
                <behavior name="webEndPoint">
                    <webhttp />
                </behavior>
            </endpointbehaviors>
            <servicebehaviors>
                <behavior name="WCFService.Service1Behavior">
                    <servicemetadata httpsgetenabled="true" />
                    <servicedebug includeexceptiondetailinfaults="false" />
                    <!--<userequestheadersformetadataaddress>
                        <defaultports>
                            <add scheme="http" port="81" />
                            <add scheme="https" port="444" />
                        </defaultports>
                    </userequestheadersformetadataaddress>-->
                    <userequestheadersformetadataaddress />
                    <!--<servicecredentials>
                        <servicecertificate>
                           findValue="60F492234A88239829AAEB5F1C6286FB684D6067"
                           x509FindType="FindByThumbprint" />
                    </servicecertificate></servicecredentials>-->
                </behavior>
            </servicebehaviors>
        </behaviors>
    </system.servicemodel>

and I am requesting the service using http client. Please help me to out of this.
Thanks.
Posted
Updated 28-May-12 19:47pm
v2

1 solution

I would make sure you have endpoint behaviour configurations in the client and server with the maxItemsInObjectGraph property set

XML
<endpointbehaviors>
        <behavior name="endpointBehavior">
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
        </behavior>
      </endpointbehaviors>


Make sure each endpoint binding uses this behaviour like:

XML
<endpoint behaviorconfiguration="endpointBehavior" ....=""></endpoint>


secondly I would check your client http request rate:
XML
<httpruntime executiontimeout="90" maxrequestlength="20000" usefullyqualifiedredirecturl="false" requestlengthdiskthreshold="8192" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900