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 4560138
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:53:19+00:00 2026-05-21T17:53:19+00:00

I have been trying to search for this error but no luck so far.

  • 0

I have been trying to search for this error but no luck so far.

So I have a service on my client with this web.config

  <system.serviceModel>
<serviceHostingEnvironment>
  <baseAddressPrefixFilters>
    <add prefix="http://www.mywebsite.com/"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="UploadService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
      contract="IUploadService">
      <identity>
        <dns value="http://www.mywebsites.com/" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior" maxReceivedMessageSize="4194304">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

and on the client I have this configuration

  <system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="WSHttpBinding_IUploadService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="524288" maxReceivedMessageSize="4194304"
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
      allowCookies="false">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="00:30:00"
        enabled="false" />
      <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None"
          realm="">
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
        <message clientCredentialType="Windows" negotiateServiceCredential="true"
          algorithmSuite="Default" establishSecurityContext="true" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://www.mywebsite.com/UploadService.svc"
    binding="basicHttpBinding" bindingConfiguration="" contract="IUploadService"
    name="WSHttpBinding_IUploadService">
    <identity>
      <dns value="http://www.mywebsite.com/" />
    </identity>
  </endpoint>
</client>

and I am uploading the files like this :-

        using (Stream stream = new FileStream(strFilePath, FileMode.Open, FileAccess.Read))
        {
            try
            {
                using (UploadServiceClient upc = new UploadServiceClient())
                {
                    upc.UploadFile(stream);
                }

            }
            catch (Exception exc)
            {

            }
        }

for small files it works fine, but for large XML files, this failes with 400 Bad Request. What I can do to change these settings to get large XML file to transfer?

Thanks for your help and time

UPDATED Client app.config

  <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBinding_IUploadService" receiveTimeout="00:20:00"
      bypassProxyOnLocal="true" maxBufferSize="4194304" maxReceivedMessageSize="4194304"
      messageEncoding="Mtom" transferMode="Streamed">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security>
        <transport>
          <extendedProtectionPolicy policyEnforcement="Never" />
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://www.mywebsite.com/UploadService.svc"
    binding="basicHttpBinding" bindingConfiguration="" contract="IUploadService"
    name="basicHttpBinding_IUploadService">
    <identity>
      <dns value="http://www.mywebsite.com/" />
    </identity>
  </endpoint>
</client>

  • 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-21T17:53:19+00:00Added an answer on May 21, 2026 at 5:53 pm

    You should to see if the service has the same maxReceivedMessageSize=”4194304″ as the client and if the XML is indeed smaller than the 4,194,304 byte limit that is set. WCF defaults to a maxReceivedMessageSize of 64K.

    UPDATE:

    I noticed your config shows the client being configured for basicHttpBinding but the config only shows a wsHttpBinding. The wsHttpBinding config would be ignored by WCF since it doesn’t pertain to basicHttpBinding. If the client config file doesn’t have a basicHttpBinding element then in .NET 4 a default one is being used. If this is true then you’ll run into the 64K limit described above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a new google custom search engine, but when
I have been trying to get around this error for a day now and
I have been trying to search for this and am not sure I am
I have been trying to work out the bug on this but can't seem
I am trying to make this work but have been unlucky it is giving
I have been trying since yesterday to get google like paging, but each time
I have this sql query where I'm trying to use CONTAINS to search the
I've been trying to figure this out for hours. I have a DYNAMIC youtube
OK, I have been trying to figure this out for a while. I just
I been looking at this for far too long here. I'm trying to use

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.