title: WCF Streamed errror (maximum message size quota)
body: <p>I have WCF service library with this config: </p>
  
  <pre><code>&lt;basicHttpBinding&gt;
     &lt;binding name="httpLargeMessageStream" 
          maxReceivedMessageSize="2147483647"      
          messageEncoding="Mtom" transferMode="Streamed" /&gt;
  &lt;/basicHttpBinding&gt;
  
  &lt;netTcpBinding&gt;
      &lt;binding name="tcpLargeMessageStream" transferMode="Streamed" 
               maxReceivedMessageSize="2147483647" /&gt;
  &lt;/netTcpBinding&gt;
  </code></pre>
  
  <p>and from client side if I send request for upload file, then all work fine </p>
  
  <pre><code>public void UploadFile(FileUploadMessage request)
  {
     try
     {
        // Gets absolute local storing path 
        string localPath = Path.Combine(basePath, request.UploadMetadata.StoringPath);
  
        // Create folders in they don't exist
        FileInfo file = new System.IO.FileInfo(localPath);
        file.Directory.Create();
  
        // Get document path on server
        string serverFileName = Path.Combine(localPath, request.UploadMetadata.HashFileName);
  
        // Create a new temp document 
        using (FileStream outfile = new FileStream(serverFileName, FileMode.Create))
        {
           // Read buffer
           const int bufferSize = 65536;
  
           // Output buffer 
           Byte[] buffer = new Byte[bufferSize];
           int bytesRead;
  
           // Write bytes from source into local file
           while ((bytesRead = request.FileByteStream.Read(buffer, 0, bufferSize)) &gt; 0)
           {
              outfile.Write(buffer, 0, bytesRead);
           }
        }
     }
     catch (IOException e)
     {
        throw new FaultException&lt;IOException&gt;(e);
     }
  }
  </code></pre>
  
  <p>but for download request I already got error: </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>
  
  <pre><code>public FileDownloadReturnMessage DownloadFile(FileDownloadMessage request)
  {
     try
     {
        controlServerAdress = "http://localhost:8080/ControlServer/";
  
        EndpointAddress basicBinding = new EndpointAddress(controlServerAdress + "TokenService/basic");
        tokenService = new TokenServiceClient("BasicHttpBinding_ITokenService", basicBinding);
  
        // Get file token form control server
        ComDocFile file = tokenService.ResolveToken(request.DownloadMetadata.Token);
  
        // If exist file for token
        if (file != null)
        {
           // Get document path on server
           string serverFileName = Path.Combine(basePath, file.FilePath, file.FileName);
  
           // Set fileName 
           request.DownloadMetadata.FileName = file.FileName;
  
           // Return file stream
           return new FileDownloadReturnMessage(new FileStream(serverFileName, FileMode.Open, FileAccess.Read), new ReturnDownloadMetaData(file.FileName, true));
        }
  
        return new FileDownloadReturnMessage(null,
                      new ReturnDownloadMetaData(null, false));
     }
     catch (IOException e)
     {
        throw new FaultException&lt;IOException&gt;(e);
     }
  }
  </code></pre>
  
  <p>Client calling method:</p>
  
  <pre><code> // Read buffer
   const int bufferSize = 65536;
  
   // Output buffer 
   Byte[] buffer = new Byte[bufferSize];
   int bytesRead;
  
   // Prepare download stream
   Stream donwloadStream;
  
   ReturnDownloadMetaData file = fileClient.DownloadFile(downloadMetaData, out donwloadStream);
  
   // If file server return valid file stream
   if (file.IsValid)
   {
      // Create a new temp document 
      using (FileStream outfile = new FileStream("C:\\#ComDocs_FileServer\\" + file.FileName, FileMode.Create))
      {
         // Write bytes from source into local file
         while ((bytesRead = donwloadStream.Read(buffer, 0, bufferSize)) &gt; 0)
         {
            outfile.Write(buffer, 0, bytesRead);
         }
      }
   }
  </code></pre>