C# WCF服务运行速度非常慢,具有可靠的会话

C# WCF服务运行速度非常慢,具有可靠的会话,c#,wcf,tcp,C#,Wcf,Tcp,服务器托管在WPF应用程序上,并对双工通道使用net.tcp绑定。我们让客户端(.NET 4.0)向服务器发送一个突发异步请求。开启可靠会话后,服务速度会变得非常慢(约50-100次呼叫/秒),回调消息不会发送到客户端 这个问题发生在两种情况下 我们每秒向服务器发送大约1000条消息。如果我们发送300-500条信息就可以了 我们向服务器发送一条大小为10-20MB的消息。在这种情况下,来自服务器回调的消息将等待大消息发送 下面是服务器和客户端的代码 服务器绑定: BaseTimeout = 7

服务器托管在WPF应用程序上,并对双工通道使用net.tcp绑定。我们让客户端(.NET 4.0)向服务器发送一个突发异步请求。开启可靠会话后,服务速度会变得非常慢(约50-100次呼叫/秒),回调消息不会发送到客户端

这个问题发生在两种情况下

  • 我们每秒向服务器发送大约1000条消息。如果我们发送300-500条信息就可以了

  • 我们向服务器发送一条大小为10-20MB的消息。在这种情况下,来自服务器回调的消息将等待大消息发送

  • 下面是服务器和客户端的代码

    服务器绑定:

    BaseTimeout = 7000;
            int.MaxValue = 2147483647;
            ///Common
                    CloseTimeout = new TimeSpan(0, 0, BaseTimeout),
                    OpenTimeout = new TimeSpan(0, 0, BaseTimeout),
                    ReceiveTimeout = new TimeSpan(0, 0, BaseTimeout*4),
                   SendTimeout = new TimeSpan(0, 0, BaseTimeout),
                    ///Security
                    Security = { Mode = SecurityMode.None },
                    ///Session
                    ReliableSession =
                    {
                        Enabled = true,
                        InactivityTimeout = new TimeSpan(1, 10, 0),
                        Ordered = true
                    },
                    ///Buffer and message
                    MaxBufferPoolSize = int.MaxValue,
                    MaxBufferSize = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    ///ReaderQuotas
                    ReaderQuotas =
                    {
                        MaxBytesPerRead = int.MaxValue,
                        MaxDepth = int.MaxValue,
                        MaxNameTableCharCount = int.MaxValue,
                        MaxStringContentLength = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    },
                    //Other
                    PortSharingEnabled = true,
                    MaxConnections = 1000,
                    TransactionFlow = true,
                    TransferMode = TransferMode.Buffered,
    
    (我们还尝试使用standart net.tcp绑定自定义的istead,但没有帮助)

    客户端配置:

    BaseTimeout = 7000;
            int.MaxValue = 2147483647;
            ///Common
                    CloseTimeout = new TimeSpan(0, 0, BaseTimeout),
                    OpenTimeout = new TimeSpan(0, 0, BaseTimeout),
                    ReceiveTimeout = new TimeSpan(0, 0, BaseTimeout*4),
                   SendTimeout = new TimeSpan(0, 0, BaseTimeout),
                    ///Security
                    Security = { Mode = SecurityMode.None },
                    ///Session
                    ReliableSession =
                    {
                        Enabled = true,
                        InactivityTimeout = new TimeSpan(1, 10, 0),
                        Ordered = true
                    },
                    ///Buffer and message
                    MaxBufferPoolSize = int.MaxValue,
                    MaxBufferSize = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    ///ReaderQuotas
                    ReaderQuotas =
                    {
                        MaxBytesPerRead = int.MaxValue,
                        MaxDepth = int.MaxValue,
                        MaxNameTableCharCount = int.MaxValue,
                        MaxStringContentLength = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    },
                    //Other
                    PortSharingEnabled = true,
                    MaxConnections = 1000,
                    TransactionFlow = true,
                    TransferMode = TransferMode.Buffered,