title: WCF - maxReceivedMessageSize
body: <p>I have a problem setting <code>maxReceivedMessageSize</code> for larger files.</p>
  
  <p>I'm getting:</p>
  
  <blockquote>
    <p>The maximum message size quota for
    incoming messages (65536) has been
    exceeded. To increase the quota, use
    the MaxReceivedMessageSize property on
    the appropriate binding element.</p>
  </blockquote>
  
  <p>Here is my server side configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="HTTPBaseAddress" value="http://localhost:8080/WelcomeMessage/"/&gt;
      &lt;add key="HTTPFileTransferAddress" value="http://localhost:8080/FileTransfer/"/&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="false" /&gt;
    &lt;/system.web&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;/system.webServer&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="FS.Services.MessageService" behaviorConfiguration="MyServiceTypeBehaviors"&gt;
          &lt;endpoint contract="FS.Interfaces.IMessageService" address="" binding="wsHttpBinding"/&gt;
      &lt;/service&gt;
        &lt;service name="FS.Services.FileTransferService" behaviorConfiguration="MyServiceTypeBehaviors"&gt;
          &lt;endpoint contract="FS.Interfaces.IFileTransferService" address="" binding="basicHttpBinding" bindingConfiguration="streamedHttpBinding"/&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="streamedHttpBinding" 
                   messageEncoding="Text" 
                   transferMode="Streamed" 
                   maxReceivedMessageSize="400000000"/&gt;
         &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="MyServiceTypeBehaviors"&gt;
            &lt;serviceMetadata httpGetEnabled="true" /&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here is my client side configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;client&gt;
        &lt;endpoint address="" binding="wsHttpBinding" contract="FS.Services.IMessageService"
          name="FS.Services.MessageService" /&gt;
        &lt;endpoint address="" binding="basicHttpBinding" bindingConfiguration="streamedHttpBinding"
          contract="FS.Services.IFileTransferService" name="FS.Services.FileTransferService" /&gt;
      &lt;/client&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="streamedHttpBinding" maxReceivedMessageSize="400000000"
            messageEncoding="Text" transferMode="Streamed"/&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This is how i connect the client:</p>
  
  <pre><code>BasicHttpBinding binding2 = new BasicHttpBinding("streamedHttpBinding");
  EndpointAddress endpoint2 = new EndpointAddress("http://localhost:8080/FileTransfer");
  ChannelFactory&lt;IFileTransferService&gt; channelFactory2 = new ChannelFactory&lt;IFileTransferService&gt;(binding2, endpoint2);
  IFileTransferService proxy2 = channelFactory2.CreateChannel();
  ((IClientChannel)proxy2).Open();
  </code></pre>
  
  <p>Also I would like to transfer any type of files up to 500mb using stream messages.
  Can someone please provide me with configuration (or solution) that would support that?</p>
  
  <p>Thanx!</p>