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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:43:09+00:00 2026-06-15T01:43:09+00:00

I am using WCF bindings with streamed transfer mode, for both uploading and downloading

  • 0

I am using WCF bindings with streamed transfer mode, for both uploading and downloading binary content to/from a service. I’ve managed to get it working. I’ll include the configuration, contracts, etc for reference.

I’ve made some tests to benchmark different bindings and encodings. Uploading results seems ok. NetTcp being the fastest, followed by BasicHttp-MTOM and then BasicHttp-Text. What suprises me is that, when downloading large files, MTOM is very slow as opposed to Text encoding with BasicHttp and Binary encoding with NetTcp.

Am I missing something? Why BasicHttp-MTOM works way slower than other bindings when uploading? Beside that I’ve implemented double buffering for downloads. This also works well with all bindings except BasicHttp with MTOM encoding. Why double buffering doesn’t help when using MTOM?

Thanks for reading, your advice and ideas about this.

Test Results:

Uploading 150 MB binary data to service. Client creates a file stream from a 150 MB file and passes to server. Server reads the stream into a memory stream. No double buffer yet. Results seems fast as there is no writing of data to file system. And bindings perform as expected.

Upload

Downloading 100 MB binary data from service. Service creates a memory stream and passes to client. Client writes to file system. Here is the results with both single and double buffer. As you can see
MTOM seems extremely slow and doesn’t respond to double buffering as well.

Download

Server configuration (left out some parts for simplicity):

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="2147483647"/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="StreamedNetTcpBinding"
                 transferMode="Streamed"
                 maxReceivedMessageSize="1099511627776">
        </binding>
      </netTcpBinding>
      <basicHttpBinding>
        <binding name="StreamedBasicHttpBindingWithMtom"
                 messageEncoding="Mtom" transferMode="Streamed"
                 maxReceivedMessageSize="1099511627776">
        </binding>
        <binding name="StreamedBasicHttpBinding"
                 transferMode="Streamed"
                 maxReceivedMessageSize="1099511627776">
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Client configuration (left out some parts for simplicity):

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="StreamedBasicHttpBindingWithMtom" 
                 maxReceivedMessageSize="1099511627776"
                 messageEncoding="Mtom" transferMode="Streamed">
        </binding>
        <binding name="StreamedBasicHttpBinding"
                 maxReceivedMessageSize="1099511627776"
                 transferMode="Streamed">
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="StreamedNetTcpBinding" transferMode="Streamed"
          maxReceivedMessageSize="1099511627776">
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

Service Contract:

[ServiceContract]
public interface IFileService
{
    [OperationContract]
    void UploadFile(DocumentData document);

    [OperationContract]
    DocumentData DownloadFile();
}

Message Contract:

[MessageContract]
public class DocumentData
{
    [MessageHeader(MustUnderstand = true)]
    public string DocumentName { get; set; }

    [MessageHeader(MustUnderstand = true)]
    public int FileLength { get; set; }

    [MessageBodyMember(Order = 1)]
    public Stream Data { get; set; }
}

Edit: This turned out to be an issue with my development environment setup at work. When I ran the same tests at home, the results was as expected.

Download

  • 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-06-15T01:43:10+00:00Added an answer on June 15, 2026 at 1:43 am

    I’ll add links that I used to implement streaming and accept this as an answer.

    Progress Indication while Uploading/Downloading Files using WCF By Dimitris Papadimitriou
    Implementation of double buffering while reading/writing from/to a stream. (See Thomas Levesque’s answer)
    Another implementation for double buffering, which does the same thing. (See Nicholas Carey’s answer)
    Return Stream from WCF service, using SqlFileStream

    Working Sample Link

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

Sidebar

Related Questions

I've got a WCF service that's using file-less activation: <bindings> <basicHttpBinding> <binding transferMode=Streamed> <security
Allright, I'm using a WCF service to handle requests from my web app and
I am using a wcf service that I created, when both hosting machine and
How can I expose a WCF service so that one client using wsHttp bindings
I am using WCF in my project to transfer data from a server (which
I am designing a WCF service with callback using named pipe binding. And when
We are using WCF service on the client side we are planning to explicitly
I can work with many WCF bindings, except netMsmqBinding . All I get is:
I am designing a duplex channel wcf service using a custom binding. Currently, when
I am using WCF to a soap endpoint using security mode TransportWithMessageCredential. The WCF

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.