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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:41:59+00:00 2026-05-23T08:41:59+00:00

I have WCF service library with this config: <basicHttpBinding> <binding name=httpLargeMessageStream maxReceivedMessageSize=2147483647 messageEncoding=Mtom transferMode=Streamed

  • 0

I have WCF service library with this config:

<basicHttpBinding>
   <binding name="httpLargeMessageStream" 
        maxReceivedMessageSize="2147483647"      
        messageEncoding="Mtom" transferMode="Streamed" />
</basicHttpBinding>

<netTcpBinding>
    <binding name="tcpLargeMessageStream" transferMode="Streamed" 
             maxReceivedMessageSize="2147483647" />
</netTcpBinding>

and from client side if I send request for upload file, then all work fine

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)) > 0)
         {
            outfile.Write(buffer, 0, bytesRead);
         }
      }
   }
   catch (IOException e)
   {
      throw new FaultException<IOException>(e);
   }
}

but for download request I already got error:

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.

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<IOException>(e);
   }
}

Client calling method:

 // 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)) > 0)
       {
          outfile.Write(buffer, 0, bytesRead);
       }
    }
 }
  • 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-23T08:41:59+00:00Added an answer on May 23, 2026 at 8:41 am

    the maxReceievedMessageSize is how big the data is that the receiver is prepared to accept. In the code above, for download, the client is the receiver. You need to increase the maxReceievedMessageSize in the client as well (you don’t appear to be doing this from the code you have shown)

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

Sidebar

Related Questions

I have this App.config in my wcf service library: <?xml version=1.0?> <configuration> <appSettings> <add
I have simple WCF Service Application (based on this tutorial http://msdn.microsoft.com/en-us/library/ms734712.aspx ). Is it
I have a WCF Service Library (implemented using NH) with one of the class
I currently have a WCF Service Library which will be started through a Console
I have created a simple wcf service which used the WCF Service Library template.
I have been working on a WCF service library where hopefully all the business
I am creating solution and inside I have three projects: A WCF Service Library
I have two Services called TemplateService, TemplateReportService (both defined in one WCF Service Library)
I have a WCF Web Service which is referenced from a class library. After
I have a WCF Service Library containing five service contracts. The library is hosted

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.