title: WCF REST service 400 Bad Request
body: <p>I have WCF RESTful service and Android client.</p>
  
  <p>Server replies with 400 when I do bigger request. It seems that I have 65k limit issue like
  in <a href="https://stackoverflow.com/questions/6324194/wcf-rest-service-template-4-0-bad-request">here</a> or in other million posts on same problem.</p>
  
  <p>However, I can't seem to be able to fix it. Here is how my web.config looks </p>
  
  <pre><code>    &lt;system.serviceModel&gt;
      &lt;diagnostics&gt;
        &lt;messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
          logMessagesAtTransportLevel="true" /&gt;
      &lt;/diagnostics&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
      &lt;standardEndpoints&gt;
        &lt;webHttpEndpoint&gt;
          &lt;standardEndpoint name="myEndpoint" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="1000000" /&gt;
        &lt;/webHttpEndpoint&gt;
      &lt;/standardEndpoints&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Here is code example of service function:</p>
  
  <pre><code>[WebInvoke(UriTemplate = "/trips/{TripId}/inspection", Method = "POST")]
          [Description("Used on mobile devices to submit inspections to server")]
          public void PostTripInspection(string tripId, Inspection inspection)
          {
              return;
          }
  </code></pre>
  
  <p>Here is code inside my Web project which hosts WCF (Global.asax.cs)</p>
  
  <pre><code>private static void RegisterRoutes()
          {
              // Setup URL's for each customer
              using (var cmc = new CoreModelContext())
              {
                  foreach (var account in cmc.Accounts.Where(aa =&gt; aa.IsActive).ToList())
                  {
                      RouteTable.Routes.Add(
                          new ServiceRoute(
                              account.AccountId + "/mobile", new WebServiceHostFactory(), typeof(MobileService)));
                  }
              }
          }
  </code></pre>
  
  <p>From what I understand Java HttpClient doesn't impose any limits so it's on WCF side. Any pointers on how to solve this issue or how to intercept message in WCF? </p>
  
  <p>EDIT 2:
  This is what trace shows. And when I modigy standardEndpoint it doesn't help...</p>
  
  <p><img src="https://i.stack.imgur.com/BlHUD.png" alt="enter image description here"></p>