Recommended deployment WCF TCP binding stack

Aborted channels in WCF can be caused by a range of issues. In most cases you just need to turn on WCF tracing and/or exception debugging to find the cause of the problem. However sometimes that doesn’t help and it may be caused by your binding settings. According to a post in this link; one of the following settings in this production ready custom binding (or perhaps all 😉 ) might help you get out of your bind (haha :P).

       reliableSession = New ReliableSessionBindingElement()

        reliableSession.Ordered = False

        reliableSession.InactivityTimeout = New TimeSpan(0, 60, 0)

        reliableSession.MaxPendingChannels = 100

        reliableSession.MaxTransferWindowSize = 16 ‘max pending messages

        reliableSession.AcknowledgementInterval = New TimeSpan(0, 0, 12) ‘acknowledge every 12 seconds (my personal choice)

        reliableSession.FlowControlEnabled = True ‘don’t send while destination buffer is full

        reliableSession.MaxRetryCount = 3

        transport = New TcpTransportBindingElement()

        transport.TransferMode = TransferMode.Buffered ‘streaming won’t work for us in the general case

        transport.MaxBufferSize = &H100400 ‘1 meg (plus extra)

        transport.MaxReceivedMessageSize = &H100400

        transport.ListenBacklog = 100

        transport.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint = 100

        transport.MaxPendingAccepts = 100

        transport.MaxPendingConnections = 100

        transport.MaxBufferPoolSize = 100

        encoding = New BinaryMessageEncodingBindingElement()

        encoding.ReaderQuotas.MaxArrayLength = Integer.MaxValue

        encoding.ReaderQuotas.MaxBytesPerRead = Integer.MaxValue

        encoding.ReaderQuotas.MaxNameTableCharCount = Integer.MaxValue

        encoding.ReaderQuotas.MaxStringContentLength = Integer.MaxValue

        binding = New CustomBinding(encoding, reliableSession, transport)

        binding.CloseTimeout = New TimeSpan(0, 0, 5)

        binding.ReceiveTimeout = TimeSpan.MaxValue

        binding.OpenTimeout = New TimeSpan(0, 0, 30)

        binding.SendTimeout = New TimeSpan(0, 0, 30)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s