File download through WCF slower than through IIS

前端 未结 6 1731
孤独总比滥情好
孤独总比滥情好 2020-12-08 03:35

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

6条回答
  •  粉色の甜心
    2020-12-08 03:59

    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);
    

提交回复
热议问题