Search code examples
wcftcpduplex

wcf: is it possible to have a duplex contract with tcp binding and streamed transfer mode?


I have a WCF service and a tcp binding. By the moment, the transfer mode is buffered, the default option, but I have problems with file transfers, so I have been advised that perhaps it's better to use the streamed transfer mode.

I configure my service for this transfer mode, and in the client, I only change the transfer mode from Buffered to Streamed.

Then, when I run the application, I get the following exception:

the tcp binding does not support duplex contract or the duplex contract is not correctly set

I only change the transfer mode, so this makes me to think that perhaps streamed is not compatible with a tcp duplex contract?

Thanks.


Solution

  • netTcpBinding in duplex mode does not support streaming, it only supports streaming for a request/reply exchange pattern (which is not duplex). What you can try doing is removing your callback, and make a service on the client which will simulate the callback. So you have your client sending data to your 'main' service, and your main service replies by streaming to the client's service, though I have no idea how much of a good practice this is considered to be.