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

  • SEARCH
  • Home
  • 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 7595861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:46:35+00:00 2026-05-30T21:46:35+00:00

My code works perfect for files smaller than 45 Kb but when I upload

  • 0

My code works perfect for files smaller than 45 Kb but when I upload files large files I get that error:

The remote server returned an error: (400) Bad Request.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The remote server returned an error: (400) Bad Request.

Source Error:

Line 120:        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
Line 121:        WebApplication2.ServiceReference1.uploadfileResponse WebApplication2.ServiceReference1.IService1.uploadfile(WebApplication2.ServiceReference1.RemoteFileInfo request) {
Line 122:            return base.Channel.uploadfile(request);
Line 123:        }
Line 124:        

Source File: C:\Users\KHALED\documents\visual studio 2010\Projects\WcfServicefiles\WebApplication2\Service References\ServiceReference1\Reference.cs
Line: 122

Stack Trace:

[WebException: The remote server returned an error: (400) Bad Request.]
   System.Net.HttpWebRequest.GetResponse() +6115427
   System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +48

[ProtocolException: The remote server returned an unexpected response: (400) Bad Request.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +9455983
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +345
   WebApplication2.ServiceReference1.IService1.uploadfile(RemoteFileInfo request) +0
   WebApplication2.ServiceReference1.Service1Client.WebApplication2.ServiceReference1.IService1.uploadfile(RemoteFileInfo request) in C:\Users\KHALED\documents\visual studio 2010\Projects\WcfServicefiles\WebApplication2\Service References\ServiceReference1\Reference.cs:122
  WebApplication2._Default.Button2_Click(Object sender, EventArgs e) in C:\Users\KHALED\documents\visual studio 2010\Projects\WcfServicefiles\WebApplication2\Default.aspx.cs:38
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

This is my webconfig code for the server:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
     <httpRuntime maxRequestLength="2097151"
    useFullyQualifiedRedirectUrl="true"
               executionTimeout="14400"

                 />
  </system.web>

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SomeServiceServiceBehavior">
          <!--   To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->

        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="Service1"
        maxReceivedMessageSize="2147483647"
        maxBufferSize="2147483647" transferMode="Streamed">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647"/>
          <security mode="None">
            <transport clientCredentialType="Ntlm"/>
          </security>
        </binding>            
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Service1.svc.cs"  >
        <endpoint address="" binding="basicHttpBinding"
                  bindingConfiguration="Service1"
                  contract="IService1" >

        </endpoint>



      </service>

    </services>


    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>

  </system.webServer>

</configuration>

And this the web.config for the client

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
      <httpRuntime maxRequestLength="2097150"      />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>

        <behavior  name="SomeServiceServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>

        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior  name="SomeServiceServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" closeTimeout="04:01:00"
          openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
     <endpoint address="http://localhost/WcfServicefiles/Service1.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
        contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
    </client>
  </system.serviceModel>
</configuration>
  • 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-30T21:46:38+00:00Added an answer on May 30, 2026 at 9:46 pm

    The below section of your servers web.config

      <services>
          <service name="Service1.svc.cs"  >
            <endpoint address="" binding="basicHttpBinding"
                      bindingConfiguration="Service1"
                      contract="IService1" >
            </endpoint>
          </service>
        </services>
    

    has some values for attributes that are wrong. The value for the name attribute of service element needs to be namespace.Service1 and similarly the contract attribute value of endpoint element needs to be namespace.IService1 as shown below:

      <services>
          <service name="<namespace>.Service1"  >
            <endpoint address="" binding="basicHttpBinding"
                      bindingConfiguration="Service1"
                      contract="<namespace>.IService1" >
            </endpoint>
          </service>
        </services>
    

    Just replace with the namespace of Service1 class. And that should work

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

Sidebar

Related Questions

a little question. I have this code, which is works perfect for files, but
Using this code to zip a folder and it works perfect on small files
I have this code to write to a file, it works perfect but I
My code works. After I copy about 10 tables I get an error. Dynamic
I have a code in Visual Studio 2008 in C++ that works with files
hi my dear friends : the below code works perfect in ie9 , but
My code works great in IE8, Firefox and Safari. But it doesn't work properly
My code works (yeah!) which sends json to a server.. would appreciate any thoughts
This code works, but i dont understand why. With DeferredLoadingEnabld = false, I would
This code works in a windows forms application (it shows the preview) but not

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.