File download through WCF slower than through IIS

前端 未结 6 1732
孤独总比滥情好
孤独总比滥情好 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 04:00

    Here is another way to do it without having to deal with Reflection. Just wrap NetTcpBinding into CustomBinding.

    var binding = new CustomBinding(new NetTcpBinding
    {
         MaxReceivedMessageSize = 2147483647,
         MaxBufferSize = 2147483647,
         MaxBufferPoolSize = 2147483647,
         ReceiveTimeout = new TimeSpan(4, 1, 0),
         OpenTimeout = new TimeSpan(4, 1, 0),
         SendTimeout = new TimeSpan(4, 1, 0),
         CloseTimeout = new TimeSpan(4, 1, 0),
         ReaderQuotas = XmlDictionaryReaderQuotas.Max,
         Security =
                {
                    Mode = SecurityMode.None,
                    Transport = {ClientCredentialType = TcpClientCredentialType.None}
                },
                TransferMode = TransferMode.Streamed,
                HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
            });
    
    binding.Elements.Find().ConnectionBufferSize = 665600;
    

提交回复
热议问题