WCF Large Image Transfer (>1GB) using TCP transport RRS feed

  • Question

  • I am trying to configure a custom binding for a duplex contract as below:

            <binding name="streamedBinding">
              <security allowInsecureTransport="true" />
              <reliableSession flowControlEnabled="true" maxPendingChannels="128" />
              <compositeDuplex />
              <tcpTransport transferMode="Streamed" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"/>

    The problem I am having is that I am getting this exception from the service host:


      Message=The binding ('CustomBinding','') supports streaming which cannot be configured together with message level security.  Consider choosing a different transfer mode or choosing the transport level security.

    Can anyone point me in the direction to help me solve this problem?

    • Edited by DTMSOFT Friday, March 8, 2019 12:51 PM
    Friday, March 8, 2019 12:15 PM

All replies

  • Maybe, you should look into WCF Chunking.
    Friday, March 8, 2019 3:31 PM
  • Hi Dtmsoft,
    Would you mind that tell me why you use Custom binding instead of NetTcpBinding?
    Can we use the following configuration as a replacement?
            <binding name="mybinding" transferMode="Streamed" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
              <security mode="None">

    Best Regards
    Monday, March 11, 2019 8:35 AM
  • Thanks Abraham. I cannot get it to work with NetTcpBinding but I will try your configuration that you have posted. Have you tried this? Does it work for you?
    Monday, March 11, 2019 11:06 AM
  • Thanks Abraham. I cannot get it to work with NetTcpBinding but I will try your configuration that you have posted. Have you tried this? Does it work for you?

    I don't think it's going to work for you without using  Custom binding to override default settings on the service side.
    Monday, March 11, 2019 5:41 PM
  • Hi, Dtmsoft,

    NetTcpbinding supports duplex communication and reliable session by default, it also works at streamed transfer mode. But I didn't try to work in transfer large file mode, looking forward to your reply.

    Best Regards


    Tuesday, March 12, 2019 2:09 AM
  • Streamed mode does not work using TCP binding with duplex contracts. But will quite happily work in Buffered mode. The problem with this is transferring large images (>500MB) is slow as the message has to sent in its entirety before it can be processed by the service.

    If I was to switch over to using Streamed mode without duplex contracts using TCP, what would a typical binding configuration look like? I also need to run this without security switched on.

    • Edited by DTMSOFT Wednesday, March 20, 2019 12:24 PM
    Wednesday, March 20, 2019 7:59 AM
  • Hi Dtmsoft,
    Do you have solved the problem? please refer to the following link.
    In addition, it is unnecessary that we set up the value of the MaxBufferSize/maxBufferPoolSize to over high.
    when transferring the large data, the following code snippets may be useful to you.
    Server end.
            <behavior name="StreamServiceBehavior">
              <serviceMetadata httpGetEnabled="True" />
            <binding name="NewBinding0" transferMode="Streamed"/>
          <service behaviorConfiguration="StreamServiceBehavior" name="Service.StreamService">
            <endpoint address="net.tcp://localhost:9000/streamserver" binding="netTcpBinding"
              bindingConfiguration="NewBinding0" bindingName="" contract="Service.IStream" />
            <endpoint address="mex" binding="mexHttpBinding"
              contract="IMetadataExchange" />
                <add baseAddress="http://localhost:8080/StreamService" />

    Client end.
                <binding name="NetTcpBinding_IStream" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:01:00"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
            <endpoint address="net.tcp://localhost:9000/streamserver" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IStream" contract="Service.IStream"

    Feel free to let me know if there is anything I can help with.
    Best Regards
    Tuesday, March 26, 2019 2:26 AM