Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:07+00:00 2026-05-23T13:29:07+00:00

I have WCF RESTful service and Android client. Server replies with 400 when I

  • 0

I have WCF RESTful service and Android client.

Server replies with 400 when I do bigger request. It seems that I have 65k limit issue like
in here or in other million posts on same problem.

However, I can’t seem to be able to fix it. Here is how my web.config looks

    <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true" />
    </diagnostics>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="myEndpoint" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="1000000" />
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

Here is code example of service function:

[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;
        }

Here is code inside my Web project which hosts WCF (Global.asax.cs)

private static void RegisterRoutes()
        {
            // Setup URL's for each customer
            using (var cmc = new CoreModelContext())
            {
                foreach (var account in cmc.Accounts.Where(aa => aa.IsActive).ToList())
                {
                    RouteTable.Routes.Add(
                        new ServiceRoute(
                            account.AccountId + "/mobile", new WebServiceHostFactory(), typeof(MobileService)));
                }
            }
        }

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?

EDIT 2:
This is what trace shows. And when I modigy standardEndpoint it doesn’t help…

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:29:07+00:00Added an answer on May 23, 2026 at 1:29 pm

    You don’t need to use streaming in this case – all you need to do is to increase the maxReceivedMessageSize quota on the standard webHttpEndpoint:

    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name=""
                          helpEnabled="true"
                          automaticFormatSelectionEnabled="true"
                          maxReceivedMessageSize="1000000"/>
      </webHttpEndpoint>
    </standardEndpoints>
    

    Update: if the config change didn’t work (I don’t know why), you can try increasing it in code. By using a custom service host factory, you get a reference to the endpoint object and you can increase the quota there. The code below shows one such a factory (you’ll need to update the RegisterRoute code to use this new factory):

    public class MyWebServiceHostFactory : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            return base.CreateServiceHost(serviceType, baseAddresses);
        }
    
        class MyWebServiceHost : WebServiceHost
        {
            public MyWebServiceHost(Type serviceType, Uri[] baseAddresses)
                : base(serviceType, baseAddresses)
            {
            }
            protected override void OnOpening()
            {
                base.OnOpening();
                foreach (ServiceEndpoint endpoint in this.Description.Endpoints)
                {
                    if (!endpoint.IsSystemEndpoint)
                    {
                        Binding binding = endpoint.Binding;
                        if (binding is WebHttpBinding)
                        {
                            ((WebHttpBinding)binding).MaxReceivedMessageSize = 1000000;
                        }
                        else
                        {
                            CustomBinding custom = binding as CustomBinding;
                            if (custom == null)
                            {
                                custom = new CustomBinding(binding);
                            }
    
                            custom.Elements.Find<HttpTransportBindingElement>().MaxReceivedMessageSize = 1000000;
                        }
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful service that I am developing in WCF . I am
I have a WCF restful service that I'm trying to upload an image to.
I have a wcf restful service with a operation contract that contains two values
I have a RESTful WCF service that exposes a method that takes in an
I have a RESTful WCF web service that processes huge XML files that are
I have a restful WCF service that is returning JSON. I was wondering how
I have a RESTful WCF application that makes use of custom classes as service
I have an old WCF 3.5 RESTful service that was at: http://www.mydomain.com/rest/Service.svc I have
I have a RESTful WCF service that can return XML, JSON, or JSONP, depending
I have a RESTful WCF service that has an upload method accepting more than

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.