title: WCF maxReceivedMessageSize issue
body: <p>I'm having the common error of MaxReceivedMessageSize of 65536.</p>
  
  <p>After reading some of the relevant posts on the forum, I'm still getting this error and just not being able to understand what I am missing.</p>
  
  <p>Heres WCF web.config:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  
    &lt;appSettings&gt;
      &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5"/&gt;
    &lt;/system.web&gt;
  
    &lt;system.serviceModel&gt;
  
    &lt;bindings&gt;
      &lt;basicHttpBinding&gt;
        &lt;binding name="ExtendedMaxSize"
            maxBufferSize="999999" maxReceivedMessageSize="999999" /&gt;
      &lt;/basicHttpBinding&gt;
    &lt;/bindings&gt;
    &lt;services&gt;
      &lt;service name="WCFHaifaNetMobile.Service1" behaviorConfiguration=""&gt;
  
        &lt;endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="ExtendedMaxSize"
                  contract="WCFHaifaNetMobile.IService1" /&gt;
      &lt;/service&gt;
    &lt;/services&gt;
  
  
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
            &lt;!-- 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 --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;protocolMapping&gt;
          &lt;add binding="wsHttpBinding" scheme="https" /&gt;
      &lt;/protocolMapping&gt;    
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;!--
          To browse web app root directory during debugging, set the value below to true.
          Set to false before deployment to avoid disclosing web app folder information.
        --&gt;
      &lt;directoryBrowse enabled="true"/&gt;
    &lt;/system.webServer&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>My MVC 4 application config file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  
  
  &lt;configuration&gt;
  
    &lt;configSections&gt;
      &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
        &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt;
      &lt;/sectionGroup&gt;
  
    &lt;/configSections&gt;
  
  
    &lt;system.web.webPages.razor&gt;
      &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt;
        &lt;namespaces&gt;
          &lt;add namespace="System.Web.Mvc" /&gt;
          &lt;add namespace="System.Web.Mvc.Ajax" /&gt;
          &lt;add namespace="System.Web.Mvc.Html" /&gt;
          &lt;add namespace="System.Web.Optimization"/&gt;
          &lt;add namespace="System.Web.Routing" /&gt;
        &lt;/namespaces&gt;
      &lt;/pages&gt;
    &lt;/system.web.webPages.razor&gt;
  
    &lt;appSettings&gt;
      &lt;add key="webpages:Enabled" value="false" /&gt;
      &lt;add key="ClientValidationEnabled" value="true"/&gt; 
      &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt; 
    &lt;/appSettings&gt;
  
    &lt;system.web&gt;
        &lt;customErrors mode="Off"&gt;
      &lt;/customErrors&gt;
  
      &lt;httpHandlers&gt;
        &lt;add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/&gt;
      &lt;/httpHandlers&gt;
  
  
      &lt;!--
          Enabling request validation in view pages would cause validation to occur
          after the input has already been processed by the controller. By default
          MVC performs request validation before a controller processes the input.
          To change this behavior apply the ValidateInputAttribute to a
          controller or action.
      --&gt;
      &lt;pages
          validateRequest="false"
          pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
          userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;controls&gt;
          &lt;add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /&gt;
        &lt;/controls&gt;
      &lt;/pages&gt;
    &lt;/system.web&gt;
  
    &lt;system.webServer&gt;
      &lt;validation validateIntegratedModeConfiguration="false" /&gt;
  
      &lt;handlers&gt;
        &lt;remove name="BlockViewHandler"/&gt;
        &lt;add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /&gt;
      &lt;/handlers&gt;
    &lt;/system.webServer&gt;
  &lt;system.serviceModel&gt;
  
    &lt;bindings&gt;
      &lt;basicHttpBinding&gt;
        &lt;binding name="ExtendedMaxSize"
            maxBufferSize="999999" maxReceivedMessageSize="999999" /&gt;
      &lt;/basicHttpBinding&gt;
    &lt;/bindings&gt;
    &lt;services&gt;
      &lt;!-- some how HaifanetMobile.ServiceClient1 is not valid--&gt;
      &lt;service name="HaifanetMobile.ServiceClient1" behaviorConfiguration=""&gt;
  
        &lt;endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="ExtendedMaxSize"
                  contract="ServiceClient1.IService1" /&gt;
      &lt;/service&gt;
    &lt;/services&gt;
  
  &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>