The following method (in which I hopefully did not make any mistakes while dramatically simplifying it for this post) is working properly and set up using the Streamed trans
I took @Greg-Smalter advice and changes ConnectionBufferSize
on NetTcpBinding
using reflection and that solved my problem. Streaming large documents is screaming fast now. Here is the code.
var transport = binding.GetType().GetField("transport", BindingFlags.NonPublic | BindingFlags.Instance)
?.GetValue(binding);
transport?.GetType().GetProperty("ConnectionBufferSize", BindingFlags.Public | BindingFlags.Instance)?.SetValue(transport, 256192);